544da4d216c1d834b355bc9bc68da7ce6b801cab
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-05  Antoine Quint  <graouts@apple.com>
2
3         <video> and scale() transforms yield shrunk small or clipped controls
4         https://bugs.webkit.org/show_bug.cgi?id=180358
5         <rdar://problem/34436124>
6
7         Unreviewed.
8
9         Use DOMMatrix vs. WebKitCSSMatrix per Simon's post-commit review feedback.
10
11         * Modules/modern-media-controls/media/media-controller.js:
12         (MediaController.prototype._updateControlsSize):
13
14 2017-12-04  Chris Dumez  <cdumez@apple.com>
15
16         Support container.getRegistration() / getRegistrations() inside service workers
17         https://bugs.webkit.org/show_bug.cgi?id=180360
18
19         Reviewed by Youenn Fablet.
20
21         Support container.getRegistration() / getRegistrations() inside service workers
22         by making sure we hop to the right thread when needed.
23
24         Test: http/tests/workers/service/ServiceWorkerGlobalScope_getRegistration.html
25
26         * dom/ScriptExecutionContext.cpp:
27         (WebCore::ScriptExecutionContext::postTaskTo):
28         * dom/ScriptExecutionContext.h:
29         * workers/service/SWClientConnection.cpp:
30         (WebCore::SWClientConnection::jobRejectedInServer):
31         (WebCore::SWClientConnection::registrationJobResolvedInServer):
32         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
33         (WebCore::SWClientConnection::startScriptFetchForServer):
34         (WebCore::SWClientConnection::clearPendingJobs):
35         * workers/service/SWClientConnection.h:
36         * workers/service/ServiceWorkerContainer.cpp:
37         (WebCore::ServiceWorkerContainer::getRegistration):
38         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
39         (WebCore::ServiceWorkerContainer::getRegistrations):
40         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
41         (WebCore::ServiceWorkerContainer::stop):
42         * workers/service/ServiceWorkerContainer.h:
43
44 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
45
46         Cleanup code that computes iframe content offsets in FrameView
47         https://bugs.webkit.org/show_bug.cgi?id=180385
48
49         Reviewed by Zalan Bujtas.
50
51         The coordinate conversion functions in FrameView explicitly added borderLeft/paddingLeft
52         and borderTop/paddingTop to compute the offset from the contents of a frame to its parent renderer.
53         
54         This is equivalent to the call to contextBoxRect() that RenderWidget::updateWidgetGeometry() does,
55         which also takes left-side scrollbars into account.
56         
57         Coordinate offsets don't need height and width, so add RenderBox::contentBoxLocation() that just
58         computes the top left, and use it in FrameView.
59
60         * page/FrameView.cpp:
61         (WebCore::FrameView::invalidateRect):
62         (WebCore::FrameView::convertToContainingView const):
63         (WebCore::FrameView::convertFromContainingView const):
64         * platform/graphics/FloatPoint.h:
65         (WebCore::FloatPoint::scaled const):
66         (WebCore::FloatPoint::scaled): Deleted.
67         * rendering/RenderBox.cpp:
68         (WebCore::RenderBox::contentBoxLocation const):
69         * rendering/RenderBox.h:
70
71 2017-12-04  Nan Wang  <n_wang@apple.com>
72
73         AX: AOM: Implement relation type properties
74         https://bugs.webkit.org/show_bug.cgi?id=179500
75
76         Reviewed by Ryosuke Niwa.
77
78         Accessibility Object Model
79         Explainer: https://wicg.github.io/aom/explainer.html
80         Spec: https://wicg.github.io/aom/spec/
81
82         Implemented the AOM support for activeDescendant, details and errorMessage.
83         The corresponding ARIA attributes all take IDREFs, and the AOM properties
84         take references to AccessibleNodes instead.
85
86         Test: accessibility/mac/AOM-relation-property.html
87
88         * accessibility/AccessibilityObject.cpp:
89         (WebCore::AccessibilityObject::getAttribute const):
90         (WebCore::AccessibilityObject::hasProperty const):
91         (WebCore::AccessibilityObject::stringValueForProperty const):
92         (WebCore::AccessibilityObject::boolValueForProperty const):
93         (WebCore::AccessibilityObject::intValueForProperty const):
94         (WebCore::AccessibilityObject::unsignedValueForProperty const):
95         (WebCore::AccessibilityObject::doubleValueForProperty const):
96         (WebCore::AccessibilityObject::elementValueForProperty const):
97         (WebCore::AccessibilityObject::supportsARIAAttributes const):
98         (WebCore::AccessibilityObject::elementsFromProperty const):
99         (WebCore::AccessibilityObject::elementsReferencedByProperty const):
100         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
101         (WebCore::AccessibilityObject::ariaDetailsElements const):
102         (WebCore::AccessibilityObject::ariaDetailsReferencingElements const):
103         (WebCore::AccessibilityObject::ariaErrorMessageElements const):
104         (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const):
105         * accessibility/AccessibilityObject.h:
106         * accessibility/AccessibilityRenderObject.cpp:
107         (WebCore::AccessibilityRenderObject::activeDescendant const):
108         * accessibility/AccessibleNode.cpp:
109         (WebCore::ariaAttributeMap):
110         (WebCore::isPropertyValueRelation):
111         (WebCore::AccessibleNode::attributeFromAXPropertyName):
112         (WebCore::AccessibleNode::setRelationProperty):
113         (WebCore::AccessibleNode::singleRelationValueForProperty):
114         (WebCore::AccessibleNode::activeDescendant const):
115         (WebCore::AccessibleNode::setActiveDescendant):
116         (WebCore::AccessibleNode::details const):
117         (WebCore::AccessibleNode::setDetails):
118         (WebCore::AccessibleNode::errorMessage const):
119         (WebCore::AccessibleNode::setErrorMessage):
120         * accessibility/AccessibleNode.h:
121         * accessibility/AccessibleNode.idl:
122         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
123         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
124
125 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
126
127         Minor DisplayRefreshMonitor-related cleanup
128         https://bugs.webkit.org/show_bug.cgi?id=179802
129
130         Reviewed by Sam Weinig.
131
132         New trace point for when the CVDisplayLink fires on its own thread.
133
134         Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
135
136         * inspector/agents/InspectorTimelineAgent.cpp:
137         (WebCore::InspectorTimelineAgent::internalStart):
138         * platform/cf/RunLoopObserver.h:
139         * platform/graphics/DisplayRefreshMonitor.cpp:
140         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
141         * platform/graphics/ca/LayerFlushScheduler.h:
142         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
143         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
144
145 2017-12-04  David Quesada  <david_quesada@apple.com>
146
147         Add a class for parsing application manifests
148         https://bugs.webkit.org/show_bug.cgi?id=177973
149         rdar://problem/34747949
150
151         Reviewed by Geoffrey Garen.
152
153         Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
154         ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
155         of the manifests's properties are implemented to start with.
156
157         ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.
158
159         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
160         * Modules/applicationmanifest/ApplicationManifest.h: Added.
161         * Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
162         (WebCore::ApplicationManifestParser::parse):
163         The main entry point for eventual clients (and currently the unit tests) to invoke
164         ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
165         uses the context exclusively for logging console warnings while parsing the manifest, and
166         not for actually executing any scripts.
167         (WebCore::ApplicationManifestParser::ApplicationManifestParser):
168         (WebCore::ApplicationManifestParser::parseManifest):
169         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
170         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
171         (WebCore::ApplicationManifestParser::logDeveloperWarning):
172         (WebCore::ApplicationManifestParser::parseStartURL):
173         (WebCore::ApplicationManifestParser::parseName):
174         (WebCore::ApplicationManifestParser::parseDescription):
175         (WebCore::ApplicationManifestParser::parseShortName):
176         (WebCore::isInScope):
177         (WebCore::ApplicationManifestParser::parseScope):
178         (WebCore::ApplicationManifestParser::parseGenericString):
179         * Modules/applicationmanifest/ApplicationManifestParser.h: Added.
180         * Sources.txt:
181         * WebCore.xcodeproj/project.pbxproj:
182         * features.json: Change the Web App Manifest feature status to "In Development"
183
184 2017-12-04  Zalan Bujtas  <zalan@apple.com>
185
186         RenderMultiColumnFlow::fragmentedFlowDescendantInserted should not destroy incoming newDescendant
187         https://bugs.webkit.org/show_bug.cgi?id=180181
188
189         Reviewed by Antti Koivisto.
190
191         This is in preparation for having all multicolumn related tree mutation in RenderTreeUpdaterMultiColumn.
192
193         Covered by fast/multicol/column-span-range-crash.html
194
195         * rendering/RenderMultiColumnFlow.cpp:
196         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
197         * rendering/RenderMultiColumnFlow.h:
198         * style/RenderTreeUpdaterMultiColumn.cpp:
199         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
200
201 2017-12-04  JF Bastien  <jfbastien@apple.com>
202
203         Update std::expected to match libc++ coding style
204         https://bugs.webkit.org/show_bug.cgi?id=180264
205
206         Reviewed by Alex Christensen.
207
208         Update various uses of Expected, mostly renaming valueOr and
209         hasValue to the STL naming convention.
210
211         * Modules/cache/DOMCache.cpp:
212         (WebCore::DOMCache::retrieveRecords):
213         (WebCore::DOMCache::batchDeleteOperation):
214         (WebCore::DOMCache::batchPutOperation):
215         * Modules/cache/DOMCacheStorage.cpp:
216         (WebCore::DOMCacheStorage::retrieveCaches):
217         (WebCore::DOMCacheStorage::open):
218         (WebCore::DOMCacheStorage::remove):
219         * Modules/cache/WorkerCacheStorageConnection.cpp:
220         (WebCore::WorkerCacheStorageConnection::doRemove):
221         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
222         (WebCore::recordsDataOrErrorFromRecords):
223         (WebCore::recordsOrErrorFromRecordsData):
224         * bindings/js/CachedScriptFetcher.cpp:
225         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
226         * contentextensions/ContentExtensionCompiler.cpp:
227         (WebCore::ContentExtensions::compileRuleList):
228         * contentextensions/ContentExtensionParser.cpp:
229         (WebCore::ContentExtensions::getDomainList):
230         (WebCore::ContentExtensions::loadTrigger):
231         (WebCore::ContentExtensions::loadRule):
232         (WebCore::ContentExtensions::loadEncodedRules):
233         (WebCore::ContentExtensions::parseRuleList):
234         * css/CSSFontFaceSrcValue.cpp:
235         (WebCore::CSSFontFaceSrcValue::cachedFont):
236         * css/CSSImageSetValue.cpp:
237         (WebCore::CSSImageSetValue::loadBestFitImage):
238         * css/CSSImageValue.cpp:
239         (WebCore::CSSImageValue::loadImage):
240         * css/StyleRuleImport.cpp:
241         (WebCore::StyleRuleImport::requestStyleSheet):
242         * dom/CallbackResult.h:
243         (WebCore::CallbackResult<ReturnType>::type const):
244         (WebCore::CallbackResult<ReturnType>::releaseReturnValue):
245         * dom/Element.cpp:
246         (WebCore::Element::getIntegralAttribute const):
247         (WebCore::Element::getUnsignedIntegralAttribute const):
248         * dom/ExceptionOr.h:
249         (WebCore::ExceptionOr<ReturnType>::hasException const):
250         (WebCore::ExceptionOr<void>::hasException const):
251         * dom/ProcessingInstruction.cpp:
252         (WebCore::ProcessingInstruction::checkStyleSheet):
253         * html/HTMLInputElement.cpp:
254         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
255         (WebCore::HTMLInputElement::minLengthAttributeChanged):
256         * html/HTMLLinkElement.cpp:
257         (WebCore::HTMLLinkElement::process):
258         * html/HTMLTextAreaElement.cpp:
259         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
260         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
261         * html/parser/HTMLParserIdioms.cpp:
262         (WebCore::parseHTMLNonNegativeInteger):
263         * html/parser/HTMLParserIdioms.h:
264         (WebCore::limitToOnlyHTMLNonNegative):
265         * loader/CrossOriginPreflightChecker.cpp:
266         (WebCore::CrossOriginPreflightChecker::startPreflight):
267         * loader/DocumentLoader.cpp:
268         (WebCore::DocumentLoader::loadMainResource):
269         * loader/DocumentThreadableLoader.cpp:
270         (WebCore::DocumentThreadableLoader::loadRequest):
271         * loader/ImageLoader.cpp:
272         (WebCore::ImageLoader::updateFromElement):
273         * loader/LinkLoader.cpp:
274         (WebCore::LinkLoader::preloadIfNeeded):
275         (WebCore::LinkLoader::loadLink):
276         * loader/MediaResourceLoader.cpp:
277         (WebCore::MediaResourceLoader::requestResource):
278         * loader/TextTrackLoader.cpp:
279         (WebCore::TextTrackLoader::load):
280         * loader/cache/CachedSVGDocumentReference.cpp:
281         (WebCore::CachedSVGDocumentReference::load):
282         * loader/icon/IconLoader.cpp:
283         (WebCore::IconLoader::startLoading):
284         * platform/URLParser.cpp:
285         (WebCore::URLParser::parseIPv4Host):
286         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
287         (WebCore::WebCoreAVCFResourceLoader::startLoading):
288         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
289         (WebCore::WebCoreAVFResourceLoader::startLoading):
290         * svg/SVGFEImageElement.cpp:
291         (WebCore::SVGFEImageElement::requestImageResource):
292         * svg/SVGFontFaceUriElement.cpp:
293         (WebCore::SVGFontFaceUriElement::loadFont):
294         * svg/SVGUseElement.cpp:
295         (WebCore::SVGUseElement::updateExternalDocument):
296         * xml/XSLImportRule.cpp:
297         (WebCore::XSLImportRule::loadSheet):
298
299 2017-12-04  Zalan Bujtas  <zalan@apple.com>
300
301         REGRESSION (r211531): Text flow changes and overlaps other text after double-click selecting paragraph
302         https://bugs.webkit.org/show_bug.cgi?id=180377
303         <rdar://problem/34337967>
304
305         Reviewed by Antti Koivisto.
306
307         Take floats into account when computing the available width for a certain vertical position.
308
309         Test: fast/block/float/simple-line-layout-float-shrink-line.html
310
311         * rendering/SimpleLineLayout.cpp:
312         (WebCore::SimpleLineLayout::updateLineConstrains):
313
314 2017-12-04  Antoine Quint  <graouts@apple.com>
315
316         <video> and scale() transforms yield shrunk small or clipped controls
317         https://bugs.webkit.org/show_bug.cgi?id=180358
318         <rdar://problem/34436124>
319
320         Reviewed by Dean Jackson.
321
322         To compute the bounds of the media controls, we would call getBoundingClientRect()
323         on the root-most element in the shadow root, which is styled to have width and height
324         set to 100%, which allows to match the metrics of the host media element, without
325         the borders.
326
327         However, if the host media element has CSS transforms applied, these would be factored
328         into calls to getBoundingClientRect() and the controls would be too large and clipped,
329         in case the scale was more than 1, or shrunk, in case the scale was less than 1.
330
331         To obtain correct metrics, we computed the complete transformation matrix applied to
332         the host media element, and apply its inverted matrix to each corner point of the
333         bounds returned for the root-most container element in the shadow root.
334
335         Then we compute the width and height of this transformed rectangle and set those to
336         be our media controls' metrics.
337
338         Test: media/modern-media-controls/css/transformed-media.html
339
340         * Modules/modern-media-controls/media/media-controller.js:
341         (MediaController.prototype._updateControlsSize):
342         (MediaController.prototype._controlsWidth): Deleted.
343
344 2017-12-04  Antoine Quint  <graouts@apple.com>
345
346         Cursor is not visible after exiting full screen video
347         https://bugs.webkit.org/show_bug.cgi?id=180247
348         <rdar://problem/33885922>
349
350         Reviewed by Dean Jackson.
351
352         There is a dedicated NSCursor method to temporarily hide the mouse cursor while the mouse is idle,
353         so we use this platform functionality, already exposed through the page chrome, instead which
354         implements the expected behavior. Now, the mouse cursor is hidden while the mouse is stationary
355         when a <video> is fullscreen, as before, but as soon as the user exits fullscreen, the mouse cursor
356         reappears.
357
358         No test provided as I don't believe this platform behavior can be tested, there is no API to query
359         whether the cursor is visible.
360
361         * page/EventHandler.cpp:
362         (WebCore::EventHandler::cancelAutoHideCursorTimer):
363         (WebCore::EventHandler::autoHideCursorTimerFired):
364
365 2017-12-04  Chris Dumez  <cdumez@apple.com>
366
367         ServiceWorkerGlobalScope::skipWaiting(Ref<DeferredPromise>&&) is unsafe
368         https://bugs.webkit.org/show_bug.cgi?id=180372
369
370         Reviewed by Youenn Fablet.
371
372         Ref the WorkerThread and capture it in the lambda. Keep the pending promises in
373         a HashMap on the ServiceWorkerGlobalScope so that they stay on the worker thread.
374
375         * workers/service/ServiceWorkerGlobalScope.cpp:
376         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
377         * workers/service/ServiceWorkerGlobalScope.h:
378
379 2017-12-04  Brady Eidson  <beidson@apple.com>
380
381         Get a directory path to SWServers for storing ServiceWorker registrations.
382         https://bugs.webkit.org/show_bug.cgi?id=180362
383
384         Reviewed by Chris Dumez.
385
386         No new tests (No observable behavior change yet).
387
388         * workers/service/server/SWServer.cpp:
389         (WebCore::SWServer::SWServer):
390         * workers/service/server/SWServer.h:
391
392 2017-12-04  Devin Rousso  <webkit@devinrousso.com>
393
394         Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
395         https://bugs.webkit.org/show_bug.cgi?id=175166
396         <rdar://problem/34040740>
397
398         Reviewed by Joseph Pecoraro.
399
400         No new tests, updated existing tests.
401
402         * inspector/InspectorCanvas.h:
403         * inspector/InspectorCanvas.cpp:
404         (WebCore::InspectorCanvas::resetRecordingData):
405
406         * inspector/InspectorCanvasAgent.h:
407         * inspector/InspectorCanvasAgent.cpp:
408         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
409         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
410
411         * inspector/InspectorInstrumentation.h:
412         * inspector/InspectorInstrumentation.cpp:
413         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
414         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
415
416         * page/PageConsoleClient.h:
417         * page/PageConsoleClient.cpp:
418         (WebCore::PageConsoleClient::record):
419         (WebCore::PageConsoleClient::recordEnd):
420
421         * workers/WorkerConsoleClient.h:
422         * workers/WorkerConsoleClient.cpp:
423         (WebCore::WorkerConsoleClient::record):
424         (WebCore::WorkerConsoleClient::recordEnd):
425
426 2017-12-04  Youenn Fablet  <youenn@apple.com>
427
428         Call "Terminate Service Worker" on all workers when all their clients are gone
429         https://bugs.webkit.org/show_bug.cgi?id=179552
430
431         Reviewed by Chris Dumez.
432
433         Tested manually.
434
435         When SWServer detects that there is no longer any client for a given client origin,
436         it iterates through the running workers to terminate them if they have the given client origin.
437         A timer of 60 seconds is used in case a user closes a tab or a window, and reopens one with the same origin shortly after.
438
439         * workers/service/server/SWServer.cpp:
440         (WebCore::SWServer::findClientByIdentifier):
441         (WebCore::SWServer::matchAll):
442         (WebCore::SWServer::registerServiceWorkerClient):
443         (WebCore::SWServer::unregisterServiceWorkerClient):
444         * workers/service/server/SWServer.h:
445
446 2017-12-04  Antti Koivisto  <antti@apple.com>
447
448         Enable selector filtering for ::before and ::after pseudo element resolution
449         https://bugs.webkit.org/show_bug.cgi?id=180364
450
451         Reviewed by Ryosuke Niwa.
452
453         Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
454
455         This is 10%+ progression in StyleBench pseudo element subtest.
456
457         * css/StyleResolver.cpp:
458         (WebCore::StyleResolver::pseudoStyleForElement):
459         * css/StyleResolver.h:
460         * style/StyleTreeResolver.cpp:
461         (WebCore::Style::TreeResolver::resolvePseudoStyle):
462
463 2017-12-04  Youenn Fablet  <youenn@apple.com>
464
465         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
466         https://bugs.webkit.org/show_bug.cgi?id=180359
467
468         Reviewed by Chris Dumez.
469
470         This algorithm is needed for implementation of claim.
471         As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
472
473         * workers/service/server/SWServerRegistration.cpp:
474         (WebCore::SWServerRegistration::removeClientUsingRegistration):
475         (WebCore::SWServerRegistration::handleClientUnload):
476         * workers/service/server/SWServerRegistration.h:
477
478 2017-12-04  Antti Koivisto  <antti@apple.com>
479
480         Remove duplicates from selector filter hashes
481         https://bugs.webkit.org/show_bug.cgi?id=180354
482
483         Reviewed by Simon Fraser.
484
485         We have only four slots for hashes in RuleSet and adding more regresses performance. To use the limited slots
486         better we should eliminate duplicates.
487
488         This patch also switches to using std::array instead of a C array for the hashes.
489
490         The patch reduces the number of selectors passing through the selector filter in StyleBench by ~0.4%.
491
492         * css/ElementRuleCollector.cpp:
493         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
494         * css/RuleSet.cpp:
495         (WebCore::RuleData::RuleData):
496         * css/RuleSet.h:
497         (WebCore::RuleData::descendantSelectorIdentifierHashes const):
498         * css/SelectorFilter.cpp:
499         (WebCore::collectDescendantSelectorIdentifierHashes):
500         (WebCore::SelectorFilter::collectIdentifierHashes):
501         * css/SelectorFilter.h:
502         (WebCore::SelectorFilter::fastRejectSelector const):
503
504 2017-12-04  Youenn Fablet  <youenn@apple.com>
505
506         WorkerCacheStorageConnection should handle the case of terminated workers
507         https://bugs.webkit.org/show_bug.cgi?id=180304
508
509         Reviewed by Chris Dumez.
510
511         No web page observable change of behavior.
512
513         Reworked WorkerCacheStorageConnection hopping.
514         Instead of refing/unrefing itself, it refs the worker thread and the main thread connection.
515         This worker thread is then used on the way back from the main thread.
516
517         * Modules/cache/WorkerCacheStorageConnection.cpp:
518         (WebCore::WorkerCacheStorageConnection::create):
519         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
520         (WebCore::WorkerCacheStorageConnection::doOpen):
521         (WebCore::WorkerCacheStorageConnection::doRemove):
522         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
523         (WebCore::WorkerCacheStorageConnection::reference):
524         (WebCore::WorkerCacheStorageConnection::dereference):
525         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
526         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
527         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
528         * Modules/cache/WorkerCacheStorageConnection.h:
529         * workers/WorkerGlobalScope.cpp:
530         (WebCore::WorkerGlobalScope::cacheStorageConnection):
531         * workers/WorkerGlobalScope.h:
532
533 2017-12-04  Frederic Wang  <fwang@igalia.com>
534
535         Make ScrollingTreeNode::enclosingFrameNode return the node itself for frame nodes
536         https://bugs.webkit.org/show_bug.cgi?id=180353
537
538         Reviewed by Antonio Gomes.
539
540         This function was introduced in bug 175135 to solve a rendering bug with fixed positioned
541         nodes in overflow nodes. For a frame node, the reference frame to use for fixed nodes is
542         actually the frame node itself or otherwise we will get the same rendering bug. This patch
543         makes enclosingFrameNode return the node itself when it is a frame node and renames it to
544         clarify this behavior. Currently, enclosingFrameNode is not used for frame nodes so the
545         behavior is unchanged.
546
547         No new tests, behavior is unchanged.
548
549         * page/scrolling/ScrollingTreeNode.cpp:
550         (WebCore::ScrollingTreeNode::enclosingFrameNodeIncludingSelf): Start the search from a frame
551         scrolling node from the node itself. Renamed to make explicit that this function may include
552         the node itself.
553         * page/scrolling/ScrollingTreeNode.h: Renamed.
554
555 2017-12-04  Michael Catanzaro  <mcatanzaro@igalia.com>
556
557         [WPE][GTK] Implement PAL::SleepDisabler
558         https://bugs.webkit.org/show_bug.cgi?id=178485
559
560         Reviewed by Carlos Garcia Campos.
561
562         Add a comment to warn about some odd use of SleepDisabler in HTMLMediaElement.
563
564         * html/HTMLMediaElement.cpp:
565         (WebCore::HTMLMediaElement::shouldDisableSleep const):
566
567 2017-12-04  Frederic Wang  <fwang@igalia.com>
568
569         Bug 161300 - Move RenderMathMLRoot:RootType and RenderMathMLScripts:ScriptsType to element classes
570         https://bugs.webkit.org/show_bug.cgi?id=161300
571
572         Reviewed by Darin Adler.
573
574         RenderMathMLRoot::m_kind and RenderMathMLScripts::m_scriptType are initialized in the
575         constructors of the renderer classes from the tag name of the corresponding elements.
576         This patch moves them into the corresponding element classes and makes them const members
577         parsed in the constructors. It also introduces a MathMLRootElement class deriving from
578         MathMLRowElement to store the new member. Finally, the types are redefined as enum classes.
579
580         No new tests, behavior unchanged and already covered by existing tests.
581
582         * Sources.txt: Add MathMLRootElement files.
583         * WebCore.xcodeproj/project.pbxproj: Ditto.
584         * mathml/MathMLAllInOne.cpp: Ditto.
585         * mathml/MathMLRootElement.cpp:
586         (WebCore::element): Override this function to downcast to MathMLRootElement.
587         (WebCore::rootTypeOf): Helper function to parse the root type, moved from RenderMathMLRoot.
588         (WebCore::MathMLRootElement::MathMLRootElement): Initialize the root type.
589         (WebCore::MathMLRootElement::create):
590         (WebCore::MathMLRootElement::createElementRenderer): Moved from MathMLRowElement.
591         * mathml/MathMLRootElement.h: New class deriving from MathMLRowElement, with a RootType
592         member exposed to the renderer class.
593         * mathml/MathMLRowElement.cpp: Remove header for RenderMathMLRoot.h.
594         (WebCore::MathMLRowElement::createElementRenderer): Moved to MathMLRootElement.
595         * mathml/MathMLScriptsElement.cpp: Introduce a script type.
596         (WebCore::scriptTypeOf): Helper function to parse the script type, moved from
597         RenerMathMLScripts.
598         (WebCore::MathMLScriptsElement::MathMLScriptsElement): Initialize the script type.
599         * mathml/MathMLScriptsElement.h: Add new script type member.
600         (WebCore::MathMLScriptsElement::scriptType const): Expose the script type to the renderer
601         class.
602         * mathml/mathtags.in: Map <msqrt> and <mroot> to MathMLRootElement.
603         * rendering/mathml/RenderMathMLRoot.cpp:
604         (WebCore::RenderMathMLRoot::RenderMathMLRoot): Use MathMLRootElement and remove parsing of
605         the root type.
606         (WebCore::RenderMathMLRoot::rootType const): Helper function to access the root type from
607         the element class.
608         (WebCore::RenderMathMLRoot::isValid const): Use rootType() and add prefix for enum class
609         values.
610         (WebCore::RenderMathMLRoot::getBase const): Ditto.
611         (WebCore::RenderMathMLRoot::getIndex const): Ditto.
612         (WebCore::RenderMathMLRoot::horizontalParameters): Ditto.
613         (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
614         (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Ditto.
615         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
616         (WebCore::RenderMathMLRoot::paint): Ditto.
617         * rendering/mathml/RenderMathMLRoot.h: Define root type as an enum class, replace
618         MathMLRowElement with MathMLRootElement, declare and use new rootType() function and remove
619         the m_kind member.
620         * rendering/mathml/RenderMathMLScripts.cpp:
621         (WebCore::RenderMathMLScripts::RenderMathMLScripts): Remove parsing of script type.
622         (WebCore::RenderMathMLScripts::scriptType const): Helper function to access the script type
623         from the element class.
624         (WebCore::RenderMathMLScripts::validateAndGetReferenceChildren): Use scriptType() and add
625         prefix for enum class values.
626         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Ditto.
627         (WebCore::RenderMathMLScripts::verticalMetrics): Ditto.
628         (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
629         * rendering/mathml/RenderMathMLScripts.h: Define root type as an enum class, declare the
630         scriptType() function and remove the m_scriptType member.
631         * rendering/mathml/RenderMathMLUnderOver.cpp:
632         (WebCore::RenderMathMLUnderOver::isValid const): Use scriptType() and add prefix for enum
633         class values.
634         (WebCore::RenderMathMLUnderOver::under const): Ditto.
635         (WebCore::RenderMathMLUnderOver::over const): Ditto.
636         (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto.
637         (WebCore::RenderMathMLUnderOver::hasAccent const): Ditto.
638         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
639
640 2017-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
641
642         [GStreamer] More leaks in TextCombinerGStreamer
643         https://bugs.webkit.org/show_bug.cgi?id=180331
644
645         Reviewed by Michael Catanzaro.
646
647         I've noticed more leaks reading the code, but I couldn't check them with valgrind, because I don't know how to
648         trigger that code path. This patch cleans up the file using smart pointer everywhere.
649
650         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
651         (webkit_text_combiner_pad_init):
652         (webkitTextCombinerPadEvent):
653         (webkitTextCombinerReleasePad):
654
655 2017-12-04  Jer Noble  <jer.noble@apple.com>
656
657         Include 'video/*' in image request Accept header if browser supports video media in image contexts.
658         https://bugs.webkit.org/show_bug.cgi?id=179178
659
660         Reviewed by Alex Christensen.
661
662         Test: http/tests/images/image-supports-video.html
663
664         Ensure that 'video/*' is included in the Accept header by asking the ImageDecoder whether "Video"
665         media is supported. The ImageDecoder will ask all it's constituent decoders, which aside from
666         ImageDecoderAVFObjC will say only support the "Image" media type.
667
668         Drive-by fix: Make sure the MIMETypeRegistry includes all the types supported by AVFoundation when
669         ImageDecoderAVFObjC is enabled. Also, now that Image reports it can support video mime types, check
670         whether MediaDocument can support a given mime type before asking ImageDocument.
671
672         * html/HTMLImageElement.cpp:
673         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
674         * loader/LinkLoader.cpp:
675         (WebCore::LinkLoader::isSupportedType):
676         * loader/cache/CachedResourceRequest.cpp:
677         (WebCore::acceptHeaderValueFromType):
678         * platform/MIMETypeRegistry.cpp:
679         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
680         (WebCore::MIMETypeRegistry::isSupportedImageOrSVGMIMEType): Deleted.
681         * platform/MIMETypeRegistry.h:
682         * platform/graphics/ImageDecoder.cpp:
683         (WebCore::ImageDecoder::supportsMediaType):
684         * platform/graphics/ImageDecoder.h:
685         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
686         (WebCore::ImageDecoderAVFObjC::supportsMediaType):
687         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
688         (WebCore::ImageDecoderAVFObjC::supportsContentType):
689         * platform/graphics/cg/ImageDecoderCG.h:
690         * platform/graphics/win/ImageDecoderDirect2D.h:
691         * platform/image-decoders/ScalableImageDecoder.h:
692         (WebCore::ScalableImageDecoder::supportsMediaType):
693         * html/parser/HTMLPreloadScanner.cpp:
694         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
695
696 2017-12-03  Yusuke Suzuki  <utatane.tea@gmail.com>
697
698         WTF shouldn't have both Thread and ThreadIdentifier
699         https://bugs.webkit.org/show_bug.cgi?id=180308
700
701         Reviewed by Darin Adler.
702
703         No behavior change.
704
705         * Modules/indexeddb/IDBActiveDOMObject.h:
706         (WebCore::IDBActiveDOMObject::originThread const):
707         (WebCore::IDBActiveDOMObject::performCallbackOnOriginThread):
708         (WebCore::IDBActiveDOMObject::callFunctionOnOriginThread):
709         (WebCore::IDBActiveDOMObject::originThreadID const): Deleted.
710         * Modules/indexeddb/IDBCursor.cpp:
711         (WebCore::IDBCursor::IDBCursor):
712         (WebCore::IDBCursor::~IDBCursor):
713         (WebCore::IDBCursor::sourcesDeleted const):
714         (WebCore::IDBCursor::transaction const):
715         (WebCore::IDBCursor::update):
716         (WebCore::IDBCursor::advance):
717         (WebCore::IDBCursor::continueFunction):
718         (WebCore::IDBCursor::uncheckedIterateCursor):
719         (WebCore::IDBCursor::deleteFunction):
720         (WebCore::IDBCursor::setGetResult):
721         * Modules/indexeddb/IDBDatabase.cpp:
722         (WebCore::IDBDatabase::~IDBDatabase):
723         (WebCore::IDBDatabase::hasPendingActivity const):
724         (WebCore::IDBDatabase::name const):
725         (WebCore::IDBDatabase::version const):
726         (WebCore::IDBDatabase::objectStoreNames const):
727         (WebCore::IDBDatabase::renameObjectStore):
728         (WebCore::IDBDatabase::renameIndex):
729         (WebCore::IDBDatabase::createObjectStore):
730         (WebCore::IDBDatabase::transaction):
731         (WebCore::IDBDatabase::deleteObjectStore):
732         (WebCore::IDBDatabase::close):
733         (WebCore::IDBDatabase::connectionToServerLost):
734         (WebCore::IDBDatabase::maybeCloseInServer):
735         (WebCore::IDBDatabase::activeDOMObjectName const):
736         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const):
737         (WebCore::IDBDatabase::stop):
738         (WebCore::IDBDatabase::startVersionChangeTransaction):
739         (WebCore::IDBDatabase::didStartTransaction):
740         (WebCore::IDBDatabase::willCommitTransaction):
741         (WebCore::IDBDatabase::didCommitTransaction):
742         (WebCore::IDBDatabase::willAbortTransaction):
743         (WebCore::IDBDatabase::didAbortTransaction):
744         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
745         (WebCore::IDBDatabase::fireVersionChangeEvent):
746         (WebCore::IDBDatabase::dispatchEvent):
747         (WebCore::IDBDatabase::didCreateIndexInfo):
748         (WebCore::IDBDatabase::didDeleteIndexInfo):
749         * Modules/indexeddb/IDBIndex.cpp:
750         (WebCore::IDBIndex::IDBIndex):
751         (WebCore::IDBIndex::~IDBIndex):
752         (WebCore::IDBIndex::name const):
753         (WebCore::IDBIndex::setName):
754         (WebCore::IDBIndex::objectStore):
755         (WebCore::IDBIndex::keyPath const):
756         (WebCore::IDBIndex::unique const):
757         (WebCore::IDBIndex::multiEntry const):
758         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
759         (WebCore::IDBIndex::openCursor):
760         (WebCore::IDBIndex::openKeyCursor):
761         (WebCore::IDBIndex::doCount):
762         (WebCore::IDBIndex::doGet):
763         (WebCore::IDBIndex::doGetKey):
764         (WebCore::IDBIndex::getAll):
765         (WebCore::IDBIndex::getAllKeys):
766         (WebCore::IDBIndex::markAsDeleted):
767         * Modules/indexeddb/IDBObjectStore.cpp:
768         (WebCore::IDBObjectStore::IDBObjectStore):
769         (WebCore::IDBObjectStore::~IDBObjectStore):
770         (WebCore::IDBObjectStore::name const):
771         (WebCore::IDBObjectStore::setName):
772         (WebCore::IDBObjectStore::keyPath const):
773         (WebCore::IDBObjectStore::indexNames const):
774         (WebCore::IDBObjectStore::transaction):
775         (WebCore::IDBObjectStore::autoIncrement const):
776         (WebCore::IDBObjectStore::openCursor):
777         (WebCore::IDBObjectStore::openKeyCursor):
778         (WebCore::IDBObjectStore::get):
779         (WebCore::IDBObjectStore::getKey):
780         (WebCore::IDBObjectStore::putOrAdd):
781         (WebCore::IDBObjectStore::doDelete):
782         (WebCore::IDBObjectStore::clear):
783         (WebCore::IDBObjectStore::createIndex):
784         (WebCore::IDBObjectStore::index):
785         (WebCore::IDBObjectStore::deleteIndex):
786         (WebCore::IDBObjectStore::doCount):
787         (WebCore::IDBObjectStore::getAll):
788         (WebCore::IDBObjectStore::getAllKeys):
789         (WebCore::IDBObjectStore::markAsDeleted):
790         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
791         * Modules/indexeddb/IDBOpenDBRequest.cpp:
792         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
793         (WebCore::IDBOpenDBRequest::onError):
794         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
795         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
796         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
797         (WebCore::IDBOpenDBRequest::dispatchEvent):
798         (WebCore::IDBOpenDBRequest::onSuccess):
799         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
800         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
801         (WebCore::IDBOpenDBRequest::requestCompleted):
802         (WebCore::IDBOpenDBRequest::requestBlocked):
803         * Modules/indexeddb/IDBRequest.cpp:
804         (WebCore::IDBRequest::~IDBRequest):
805         (WebCore:: const):
806         (WebCore::IDBRequest::setSource):
807         (WebCore::IDBRequest::setVersionChangeTransaction):
808         (WebCore::IDBRequest::transaction const):
809         (WebCore::IDBRequest::sourceObjectStoreIdentifier const):
810         (WebCore::IDBRequest::sourceIndexIdentifier const):
811         (WebCore::IDBRequest::requestedObjectStoreRecordType const):
812         (WebCore::IDBRequest::requestedIndexRecordType const):
813         (WebCore::IDBRequest::eventTargetInterface const):
814         (WebCore::IDBRequest::activeDOMObjectName const):
815         (WebCore::IDBRequest::canSuspendForDocumentSuspension const):
816         (WebCore::IDBRequest::hasPendingActivity const):
817         (WebCore::IDBRequest::stop):
818         (WebCore::IDBRequest::enqueueEvent):
819         (WebCore::IDBRequest::dispatchEvent):
820         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
821         (WebCore::IDBRequest::setResult):
822         (WebCore::IDBRequest::setResultToStructuredClone):
823         (WebCore::IDBRequest::setResultToUndefined):
824         (WebCore::IDBRequest::resultCursor):
825         (WebCore::IDBRequest::willIterateCursor):
826         (WebCore::IDBRequest::didOpenOrIterateCursor):
827         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
828         (WebCore::IDBRequest::onError):
829         (WebCore::IDBRequest::onSuccess):
830         * Modules/indexeddb/IDBTransaction.cpp:
831         (WebCore::IDBTransaction::IDBTransaction):
832         (WebCore::IDBTransaction::~IDBTransaction):
833         (WebCore::IDBTransaction::objectStoreNames const):
834         (WebCore::IDBTransaction::db):
835         (WebCore::IDBTransaction::error const):
836         (WebCore::IDBTransaction::objectStore):
837         (WebCore::IDBTransaction::abortDueToFailedRequest):
838         (WebCore::IDBTransaction::transitionedToFinishing):
839         (WebCore::IDBTransaction::abort):
840         (WebCore::IDBTransaction::internalAbort):
841         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
842         (WebCore::IDBTransaction::activeDOMObjectName const):
843         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const):
844         (WebCore::IDBTransaction::hasPendingActivity const):
845         (WebCore::IDBTransaction::stop):
846         (WebCore::IDBTransaction::isActive const):
847         (WebCore::IDBTransaction::isFinishedOrFinishing const):
848         (WebCore::IDBTransaction::addRequest):
849         (WebCore::IDBTransaction::removeRequest):
850         (WebCore::IDBTransaction::scheduleOperation):
851         (WebCore::IDBTransaction::schedulePendingOperationTimer):
852         (WebCore::IDBTransaction::pendingOperationTimerFired):
853         (WebCore::IDBTransaction::operationCompletedOnServer):
854         (WebCore::IDBTransaction::scheduleCompletedOperationTimer):
855         (WebCore::IDBTransaction::completedOperationTimerFired):
856         (WebCore::IDBTransaction::commit):
857         (WebCore::IDBTransaction::commitOnServer):
858         (WebCore::IDBTransaction::finishAbortOrCommit):
859         (WebCore::IDBTransaction::didStart):
860         (WebCore::IDBTransaction::notifyDidAbort):
861         (WebCore::IDBTransaction::didAbort):
862         (WebCore::IDBTransaction::didCommit):
863         (WebCore::IDBTransaction::fireOnComplete):
864         (WebCore::IDBTransaction::fireOnAbort):
865         (WebCore::IDBTransaction::enqueueEvent):
866         (WebCore::IDBTransaction::dispatchEvent):
867         (WebCore::IDBTransaction::createObjectStore):
868         (WebCore::IDBTransaction::createObjectStoreOnServer):
869         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
870         (WebCore::IDBTransaction::renameObjectStore):
871         (WebCore::IDBTransaction::renameObjectStoreOnServer):
872         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
873         (WebCore::IDBTransaction::createIndex):
874         (WebCore::IDBTransaction::createIndexOnServer):
875         (WebCore::IDBTransaction::didCreateIndexOnServer):
876         (WebCore::IDBTransaction::renameIndex):
877         (WebCore::IDBTransaction::renameIndexOnServer):
878         (WebCore::IDBTransaction::didRenameIndexOnServer):
879         (WebCore::IDBTransaction::requestOpenCursor):
880         (WebCore::IDBTransaction::doRequestOpenCursor):
881         (WebCore::IDBTransaction::openCursorOnServer):
882         (WebCore::IDBTransaction::didOpenCursorOnServer):
883         (WebCore::IDBTransaction::iterateCursor):
884         (WebCore::IDBTransaction::iterateCursorOnServer):
885         (WebCore::IDBTransaction::didIterateCursorOnServer):
886         (WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
887         (WebCore::IDBTransaction::requestGetAllIndexRecords):
888         (WebCore::IDBTransaction::getAllRecordsOnServer):
889         (WebCore::IDBTransaction::didGetAllRecordsOnServer):
890         (WebCore::IDBTransaction::requestGetRecord):
891         (WebCore::IDBTransaction::requestGetValue):
892         (WebCore::IDBTransaction::requestGetKey):
893         (WebCore::IDBTransaction::requestIndexRecord):
894         (WebCore::IDBTransaction::getRecordOnServer):
895         (WebCore::IDBTransaction::didGetRecordOnServer):
896         (WebCore::IDBTransaction::requestCount):
897         (WebCore::IDBTransaction::getCountOnServer):
898         (WebCore::IDBTransaction::didGetCountOnServer):
899         (WebCore::IDBTransaction::requestDeleteRecord):
900         (WebCore::IDBTransaction::deleteRecordOnServer):
901         (WebCore::IDBTransaction::didDeleteRecordOnServer):
902         (WebCore::IDBTransaction::requestClearObjectStore):
903         (WebCore::IDBTransaction::clearObjectStoreOnServer):
904         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
905         (WebCore::IDBTransaction::requestPutOrAdd):
906         (WebCore::IDBTransaction::putOrAddOnServer):
907         (WebCore::IDBTransaction::didPutOrAddOnServer):
908         (WebCore::IDBTransaction::deleteObjectStore):
909         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
910         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
911         (WebCore::IDBTransaction::deleteIndex):
912         (WebCore::IDBTransaction::deleteIndexOnServer):
913         (WebCore::IDBTransaction::didDeleteIndexOnServer):
914         (WebCore::IDBTransaction::operationCompletedOnClient):
915         (WebCore::IDBTransaction::establishOnServer):
916         (WebCore::IDBTransaction::activate):
917         (WebCore::IDBTransaction::deactivate):
918         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
919         (WebCore::IDBClient::removeItemsMatchingCurrentThread):
920         * Modules/indexeddb/client/TransactionOperation.h:
921         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
922         (WebCore::IDBClient::TransactionOperation::perform):
923         (WebCore::IDBClient::TransactionOperation::transitionToCompleteOnThisThread):
924         (WebCore::IDBClient::TransactionOperation::transitionToComplete):
925         (WebCore::IDBClient::TransactionOperation::doComplete):
926         (WebCore::IDBClient::TransactionOperation::originThread const):
927         (WebCore::IDBClient::TransactionOperation::originThreadID const): Deleted.
928         * Modules/webaudio/AudioContext.cpp:
929         (WebCore::AudioContext::AudioContext):
930         (WebCore::AudioContext::lock):
931         (WebCore::AudioContext::tryLock):
932         (WebCore::AudioContext::unlock):
933         (WebCore::AudioContext::isAudioThread const):
934         (WebCore::AudioContext::isGraphOwner const):
935         * Modules/webaudio/AudioContext.h:
936         (WebCore::AudioContext::setAudioThread):
937         (WebCore::AudioContext::audioThread const):
938         * Modules/webaudio/AudioDestinationNode.cpp:
939         (WebCore::AudioDestinationNode::render):
940         * Modules/webdatabase/Database.cpp:
941         (WebCore::Database::performClose):
942         (WebCore::Database::securityOrigin):
943         * Modules/webdatabase/DatabaseDetails.h:
944         (WebCore::DatabaseDetails::DatabaseDetails):
945         (WebCore::DatabaseDetails::operator=):
946         (WebCore::DatabaseDetails::thread const):
947         (WebCore::DatabaseDetails::threadID const): Deleted.
948         * Modules/webdatabase/DatabaseManager.cpp:
949         (WebCore::DatabaseManager::detailsForNameAndOrigin):
950         * Modules/webdatabase/DatabaseThread.cpp:
951         (WebCore::DatabaseThread::databaseThread):
952         (WebCore::DatabaseThread::recordDatabaseOpen):
953         (WebCore::DatabaseThread::recordDatabaseClosed):
954         * Modules/webdatabase/DatabaseThread.h:
955         (WebCore::DatabaseThread::getThread):
956         (WebCore::DatabaseThread::getThreadID): Deleted.
957         * Modules/webdatabase/SQLTransaction.cpp:
958         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
959         * Modules/webdatabase/SQLTransactionBackend.cpp:
960         (WebCore::SQLTransactionBackend::doCleanup):
961         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
962         * bindings/js/JSCallbackData.h:
963         (WebCore::JSCallbackData::JSCallbackData):
964         (WebCore::JSCallbackData::~JSCallbackData):
965         * bindings/js/ScheduledAction.cpp:
966         (WebCore::ScheduledAction::execute):
967         * dom/ScriptExecutionContext.cpp:
968         (WebCore::ScriptExecutionContext::createdMessagePort):
969         (WebCore::ScriptExecutionContext::destroyedMessagePort):
970         * page/ResourceUsageOverlay.h:
971         * page/scrolling/ScrollingThread.cpp:
972         (WebCore::ScrollingThread::isCurrentThread):
973         * platform/Supplementable.h:
974         (WebCore::Supplementable::provideSupplement):
975         (WebCore::Supplementable::removeSupplement):
976         (WebCore::Supplementable::requireSupplement):
977         (WebCore::Supplementable::Supplementable): Deleted.
978         * platform/Timer.cpp:
979         (WebCore::TimerBase::TimerBase):
980         (WebCore::TimerBase::start):
981         (WebCore::TimerBase::stop):
982         (WebCore::TimerBase::setNextFireTime):
983         * platform/Timer.h:
984         (WebCore::TimerBase::isActive const):
985         * platform/graphics/cocoa/FontCacheCoreText.cpp:
986         (WebCore::shouldAutoActivateFontIfNeeded):
987         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
988         (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
989         (WebCore::TextureMapperPlatformLayerProxy::invalidate):
990         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
991         (WebCore::TextureMapperPlatformLayerProxy::appendToUnusedBuffers):
992         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer):
993         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
994         (): Deleted.
995         * platform/ios/wak/WebCoreThread.mm:
996         (RunWebThread):
997         (StartWebThread):
998         * platform/sql/SQLiteDatabase.cpp:
999         (WebCore::SQLiteDatabase::open):
1000         (WebCore::SQLiteDatabase::close):
1001         * platform/sql/SQLiteDatabase.h:
1002         (WebCore::SQLiteDatabase::sqlite3Handle const):
1003         * workers/WorkerGlobalScope.cpp:
1004         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
1005         (WebCore::WorkerGlobalScope::isContextThread const):
1006         * workers/WorkerMessagingProxy.cpp:
1007         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
1008         (WebCore::WorkerMessagingProxy::~WorkerMessagingProxy):
1009         * workers/WorkerRunLoop.cpp:
1010         (WebCore::WorkerRunLoop::runInMode):
1011         (WebCore::WorkerRunLoop::runCleanupTasks):
1012         * workers/WorkerThread.h:
1013         (WebCore::WorkerThread::thread const):
1014         (WebCore::WorkerThread::threadID const): Deleted.
1015         * workers/service/ServiceWorkerContainer.cpp:
1016         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
1017         (WebCore::ServiceWorkerContainer::scheduleJob):
1018         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1019         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
1020         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1021         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1022         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1023         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1024         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1025         (WebCore::ServiceWorkerContainer::jobDidFinish):
1026         (WebCore::ServiceWorkerContainer::addRegistration):
1027         (WebCore::ServiceWorkerContainer::removeRegistration):
1028         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
1029         (WebCore::ServiceWorkerContainer::contextIdentifier):
1030         * workers/service/ServiceWorkerContainer.h:
1031         * workers/service/ServiceWorkerJob.cpp:
1032         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
1033         (WebCore::ServiceWorkerJob::failedWithException):
1034         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
1035         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
1036         (WebCore::ServiceWorkerJob::startScriptFetch):
1037         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1038         (WebCore::ServiceWorkerJob::didReceiveResponse):
1039         (WebCore::ServiceWorkerJob::notifyFinished):
1040         * workers/service/ServiceWorkerJob.h:
1041         * xml/parser/XMLDocumentParserLibxml2.cpp:
1042         (WebCore::matchFunc):
1043         (WebCore::openFunc):
1044         (WebCore::initializeXMLParser):
1045         (WebCore::XMLParserContext::createStringParser):
1046         (WebCore::XMLParserContext::createMemoryParser):
1047
1048 2017-12-03  Youenn Fablet  <youenn@apple.com>
1049
1050         WebSocketChannel should ensure its client is live when calling it in error case
1051         https://bugs.webkit.org/show_bug.cgi?id=180285
1052
1053         Reviewed by Darin Adler.
1054
1055         No observable change of behavior.
1056         This makes it consistent with other calls of didReceiveMessageError.
1057
1058         * Modules/websockets/WebSocketChannel.cpp:
1059         (WebCore::WebSocketChannel::fail):
1060
1061 2017-12-03  Alexey Proskuryakov  <ap@apple.com>
1062
1063         WebArchiveResourceWebResourceHandler leaks when pasting
1064         https://bugs.webkit.org/show_bug.cgi?id=180339
1065
1066         Reviewed by Joseph Pecoraro.
1067
1068         * editing/cocoa/WebContentReaderCocoa.mm:
1069         (WebCore::attributesForAttributedStringConversion):
1070
1071 2017-12-03  Chris Dumez  <cdumez@apple.com>
1072
1073         Support serviceWorker.postMessage() inside service workers
1074         https://bugs.webkit.org/show_bug.cgi?id=180328
1075
1076         Reviewed by Darin Adler.
1077
1078         Support serviceWorker.postMessage() inside service workers.
1079
1080         No new tests, unskipped and rebaselined existing test that is
1081         now passing.
1082
1083         * workers/service/SWClientConnection.h:
1084         * workers/service/ServiceWorker.cpp:
1085         (WebCore::ServiceWorker::postMessage):
1086         * workers/service/context/SWContextManager.cpp:
1087         (WebCore::SWContextManager::postMessageToServiceWorker):
1088         * workers/service/context/SWContextManager.h:
1089         * workers/service/context/ServiceWorkerThread.cpp:
1090         (WebCore::fireMessageEvent):
1091         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
1092         * workers/service/context/ServiceWorkerThread.h:
1093
1094 2017-12-03  Chris Dumez  <cdumez@apple.com>
1095
1096         Implement self.skipWaiting() inside service workers
1097         https://bugs.webkit.org/show_bug.cgi?id=180329
1098
1099         Reviewed by Darin Adler.
1100
1101         Implement self.skipWaiting() inside service workers:
1102         - https://w3c.github.io/ServiceWorker/#service-worker-global-scope-skipwaiting
1103
1104         Also fixes a bug where tryActivate() was calling activate() even though the
1105         registration's active worker was "in use":
1106         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
1107
1108         No new tests, rebaselined existing tests.
1109
1110         * workers/service/ServiceWorkerGlobalScope.cpp:
1111         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1112         * workers/service/context/SWContextManager.h:
1113         * workers/service/server/SWServerRegistration.cpp:
1114         (WebCore::SWServerRegistration::tryActivate):
1115         * workers/service/server/SWServerToContextConnection.cpp:
1116         (WebCore::SWServerToContextConnection::skipWaiting):
1117         * workers/service/server/SWServerToContextConnection.h:
1118         * workers/service/server/SWServerWorker.cpp:
1119         (WebCore::SWServerWorker::skipWaiting):
1120         * workers/service/server/SWServerWorker.h:
1121         (WebCore::SWServerWorker::isSkipWaitingFlagSet const):
1122
1123 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1124
1125         [GStreamer] GstPad leaked in WebKitTextCombiner
1126         https://bugs.webkit.org/show_bug.cgi?id=180314
1127
1128         Reviewed by Michael Catanzaro.
1129
1130         gst_element_get_static_pad() returns a full reference that si never freed, because gst_ghost_pad_new doesn't
1131         take the ownership of the given pad.
1132
1133         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
1134         (webkit_text_combiner_init):
1135
1136 2017-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1137
1138         [GStreamer] GstCaps leaked in MediaPlayerPrivateGStreamer::createGSTPlayBin
1139         https://bugs.webkit.org/show_bug.cgi?id=180311
1140
1141         Reviewed by Michael Catanzaro.
1142
1143         gst_caps_new_empty_simple() is passed directly to g_object_set(). The returned caps should be freed with
1144         gst_caps_unref().
1145
1146         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1147         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1148
1149 2017-12-02  Youenn Fablet  <youenn@apple.com>
1150
1151         Move registration activation and clearing from SWServerJobQueue to SWServerRegistration
1152         https://bugs.webkit.org/show_bug.cgi?id=180325
1153
1154         Reviewed by Chris Dumez.
1155
1156         No change of behavior.
1157
1158         These algorithms fit naturally in SWServerRegistration and will be used as part of clients.claim.
1159
1160         * workers/service/server/SWServer.cpp:
1161         (WebCore::SWServer::clearAll):
1162         (WebCore::SWServer::didFinishActivation):
1163         * workers/service/server/SWServerJobQueue.cpp:
1164         (WebCore::SWServerJobQueue::scriptFetchFinished):
1165         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1166         (WebCore::SWServerJobQueue::didFinishInstall):
1167         (WebCore::SWServerJobQueue::runUnregisterJob):
1168         (WebCore::SWServerJobQueue::tryActivate): Deleted.
1169         (WebCore::SWServerJobQueue::activate): Deleted.
1170         (WebCore::SWServerJobQueue::didFinishActivation): Deleted.
1171         (WebCore::SWServerJobQueue::tryClearRegistration): Deleted.
1172         (WebCore::clearRegistrationWorker): Deleted.
1173         (WebCore::SWServerJobQueue::clearRegistration): Deleted.
1174         * workers/service/server/SWServerJobQueue.h:
1175         * workers/service/server/SWServerRegistration.cpp:
1176         (WebCore::SWServerRegistration::tryClear):
1177         (WebCore::clearRegistrationWorker):
1178         (WebCore::SWServerRegistration::clear):
1179         (WebCore::SWServerRegistration::tryActivate):
1180         (WebCore::SWServerRegistration::activate):
1181         (WebCore::SWServerRegistration::didFinishActivation):
1182         * workers/service/server/SWServerRegistration.h:
1183
1184 2017-12-02  Chris Dumez  <cdumez@apple.com>
1185
1186         Support container.register() / registration.unregister() /  inside service workers
1187         https://bugs.webkit.org/show_bug.cgi?id=180326
1188
1189         Reviewed by Youenn Fablet.
1190
1191         Support container.register() / registration.unregister() /  inside service workers.
1192         This is mostly about removing the is<Document>() checks and adding testing given
1193         that most of the work was done in r225455.
1194
1195         Test: http/tests/workers/service/ServiceWorkerGlobalScope_register.html
1196
1197         * workers/service/ServiceWorkerContainer.cpp:
1198         (WebCore::ServiceWorkerContainer::addRegistration):
1199         * workers/service/ServiceWorkerRegistration.cpp:
1200         (WebCore::ServiceWorkerRegistration::update):
1201         (WebCore::ServiceWorkerRegistration::unregister):
1202
1203 2017-12-02  Chris Dumez  <cdumez@apple.com>
1204
1205         Support serviceWorkerRegistration.update() inside service workers
1206         https://bugs.webkit.org/show_bug.cgi?id=180215
1207
1208         Reviewed by Darin Adler.
1209
1210         Support serviceWorkerRegistration.update() inside service workers. The code paths
1211         for job scheduling and resolution have been made thread safe by hopping to the right
1212         thread when necessary. In particular, ServiceWorkerContainer always makes sure to to
1213         a callOnMainThread() before calling methods on the SWClientConnection. Also, the
1214         SWClientConnection relies on a new postTaskTo() method before calling methods on the
1215         job.
1216
1217         Test: http/tests/workers/service/self_registration_update.html
1218
1219         * workers/service/SWClientConnection.cpp:
1220         (WebCore::SWClientConnection::scheduleJob):
1221         (WebCore::SWClientConnection::finishedFetchingScript):
1222         (WebCore::SWClientConnection::failedFetchingScript):
1223         (WebCore::SWClientConnection::jobRejectedInServer):
1224         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1225         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1226         (WebCore::SWClientConnection::startScriptFetchForServer):
1227         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1228         (WebCore::SWClientConnection::updateRegistrationState):
1229         (WebCore::SWClientConnection::updateWorkerState):
1230         (WebCore::SWClientConnection::fireUpdateFoundEvent):
1231         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
1232         (WebCore::SWClientConnection::clearPendingJobs):
1233         (WebCore::SWClientConnection::postTaskTo):
1234         * workers/service/SWClientConnection.h:
1235         * workers/service/ServiceWorkerContainer.cpp:
1236         (WebCore::ServiceWorkerContainer::scheduleJob):
1237         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1238         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
1239         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1240         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1241         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1242         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1243         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1244         (WebCore::ServiceWorkerContainer::jobDidFinish):
1245         (WebCore::ServiceWorkerContainer::addRegistration):
1246         (WebCore::ServiceWorkerContainer::removeRegistration):
1247         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
1248         (WebCore::ServiceWorkerContainer::contextIdentifier):
1249         * workers/service/ServiceWorkerContainer.h:
1250         * workers/service/ServiceWorkerJob.cpp:
1251         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
1252         * workers/service/ServiceWorkerJob.h:
1253         (WebCore::ServiceWorkerJob::contextIdentifier):
1254         * workers/service/ServiceWorkerJobClient.h:
1255         * workers/service/ServiceWorkerRegistration.cpp:
1256         (WebCore::ServiceWorkerRegistration::update):
1257         * workers/service/ServiceWorkerTypes.h:
1258
1259 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1260
1261         Make IOSurface::Locker and use it in ImageBufferDataCG
1262         https://bugs.webkit.org/show_bug.cgi?id=180317
1263
1264         Reviewed by Zalan Bujtas.
1265
1266         Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
1267         to the IOSurface base address is through the locker.
1268         
1269         Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().
1270         
1271         After this, there is only one location where we access the IOSurfaceRef
1272         directly, in WebGL code.
1273
1274         * platform/graphics/cg/ImageBufferDataCG.cpp:
1275         (WebCore::ImageBufferData::toBGRAData const):
1276         (WebCore::ImageBufferData::getData const):
1277         (WebCore::ImageBufferData::putData):
1278         * platform/graphics/cocoa/IOSurface.h:
1279         * platform/graphics/cocoa/IOSurface.mm:
1280         (WebCore::IOSurface::bytesPerRow const):
1281
1282 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1283
1284         Add an AlphaPremultiplication enum and use it consistently
1285         https://bugs.webkit.org/show_bug.cgi?id=180316
1286
1287         Reviewed by Zalan Bujtas.
1288
1289         ImageBuffer-related code sometimes used the 'Multiply' enum, and sometimes
1290         a bool to represent alpha premultiplication. Make an enum class and use it
1291         everywhere. Re-order and rename some parameters to clarify the meaning of this
1292         argument.
1293
1294         * html/canvas/CanvasRenderingContext2D.cpp:
1295         (WebCore::CanvasRenderingContext2D::putImageData):
1296         * platform/graphics/GraphicsTypes.cpp:
1297         (WebCore::operator<<):
1298         * platform/graphics/GraphicsTypes.h:
1299         * platform/graphics/ImageBuffer.cpp:
1300         (WebCore::ImageBuffer::genericConvertToLuminanceMask):
1301         * platform/graphics/ImageBuffer.h:
1302         * platform/graphics/ShadowBlur.cpp:
1303         (WebCore::ShadowBlur::blurShadowBuffer):
1304         * platform/graphics/cairo/ImageBufferCairo.cpp:
1305         (WebCore::getImageData):
1306         (WebCore::ImageBuffer::getUnmultipliedImageData const):
1307         (WebCore::ImageBuffer::getPremultipliedImageData const):
1308         (WebCore::ImageBuffer::putByteArray):
1309         * platform/graphics/cg/ImageBufferCG.cpp:
1310         (WebCore::ImageBuffer::getUnmultipliedImageData const):
1311         (WebCore::ImageBuffer::getPremultipliedImageData const):
1312         (WebCore::ImageBuffer::putByteArray):
1313         * platform/graphics/cg/ImageBufferDataCG.cpp:
1314         (WebCore::ImageBufferData::getData const):
1315         (WebCore::ImageBufferData::putData):
1316         * platform/graphics/cg/ImageBufferDataCG.h:
1317         * platform/graphics/filters/FEColorMatrix.cpp:
1318         (WebCore::FEColorMatrix::platformApplySoftware):
1319         * platform/graphics/filters/FEDropShadow.cpp:
1320         (WebCore::FEDropShadow::platformApplySoftware):
1321         * platform/graphics/filters/FilterEffect.cpp:
1322         (WebCore::FilterEffect::imageBufferResult):
1323         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1324         (WebCore::ImageBufferData::getData const):
1325         (WebCore::ImageBufferData::putData):
1326         * platform/graphics/win/ImageBufferDataDirect2D.h:
1327         * platform/graphics/win/ImageBufferDirect2D.cpp:
1328         (WebCore::ImageBuffer::getUnmultipliedImageData const):
1329         (WebCore::ImageBuffer::getPremultipliedImageData const):
1330         (WebCore::ImageBuffer::putByteArray):
1331
1332 2017-12-02  Youenn Fablet  <youenn@apple.com>
1333
1334         Implement https://w3c.github.io/ServiceWorker/#clients-getall
1335         https://bugs.webkit.org/show_bug.cgi?id=180276
1336
1337         Reviewed by Chris Dumez.
1338
1339         Test: http/tests/workers/service/serviceworkerclients-matchAll.https.html
1340
1341         Move Clients QueryOptions to its own class since it is used by various parties.
1342         Add encoder/decoder routines.
1343
1344         Add a ServieWorkerClientInformation which replaces SWServer::ClientInformation structure.
1345         This is what is sent back as a result to matchAll requests.
1346         Add encoder/decoder routines.
1347
1348         Implement matchAll by hopping to the main thread, making IPC to the storage process.
1349         SWServer in storage process then iterates through the relevant service workers and does some filtering.
1350         Additional filtering and information should be gathered in future patches to fully implement the algorithm.
1351
1352         Add to SWServer a HashMap to easily identify by which service worker a client is controlled, if any.
1353         This map is updated at the same time registrations are updated.
1354
1355         matchAll is given a callback as in the future, window client information will be retrieved asynchronously.
1356
1357         * WebCore.xcodeproj/project.pbxproj:
1358         * workers/service/ServiceWorkerClientInformation.h: Added.
1359         (WebCore::ServiceWorkerClientInformation::isolatedCopy const):
1360         (WebCore::ServiceWorkerClientInformation::encode const):
1361         (WebCore::ServiceWorkerClientInformation::decode):
1362         * workers/service/ServiceWorkerClientQueryOptions.h: Added.
1363         (WebCore::ServiceWorkerClientQueryOptions::encode const):
1364         (WebCore::ServiceWorkerClientQueryOptions::decode):
1365         * workers/service/ServiceWorkerClients.cpp:
1366         (WebCore::ServiceWorkerClients::matchAll):
1367         * workers/service/ServiceWorkerClients.h:
1368         * workers/service/context/SWContextManager.h:
1369         * workers/service/server/SWServer.cpp:
1370         (WebCore::SWServer::matchAll):
1371         (WebCore::SWServer::registerServiceWorkerClient):
1372         * workers/service/server/SWServer.h:
1373         * workers/service/server/SWServerToContextConnection.cpp:
1374         (WebCore::SWServerToContextConnection::matchAll):
1375         * workers/service/server/SWServerToContextConnection.h:
1376         * workers/service/server/SWServerWorker.cpp:
1377         (WebCore::SWServerWorker::matchAll):
1378         * workers/service/server/SWServerWorker.h:
1379
1380 2017-12-02  Brady Eidson  <beidson@apple.com>
1381
1382         Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.
1383         https://bugs.webkit.org/show_bug.cgi?id=180298
1384
1385         Reviewed by Chris Dumez.
1386
1387         No new tests (Refactor only).
1388
1389         * Modules/indexeddb/server/IDBServer.cpp:
1390         (WebCore::IDBServer::IDBServer::IDBServer):
1391         (WebCore::IDBServer::IDBServer::postDatabaseTask):
1392         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply):
1393         (WebCore::IDBServer::IDBServer::databaseRunLoop): Deleted.
1394         (WebCore::IDBServer::IDBServer::handleTaskRepliesOnMainThread): Deleted.
1395         * Modules/indexeddb/server/IDBServer.h:
1396         (): Deleted.
1397
1398 2017-12-02  Simon Fraser  <simon.fraser@apple.com>
1399
1400         Add a log channel for viewports
1401         https://bugs.webkit.org/show_bug.cgi?id=180295
1402
1403         Reviewed by Zalan Bujtas.
1404
1405         Add a "Viewports" log channel to log viewport scaling information, and enhance the
1406         WebKit "VisibleRects" channel to log additional data for the same reason.
1407
1408         * dom/Document.cpp:
1409         (WebCore::Document::processViewport):
1410         * loader/FrameLoader.cpp:
1411         (WebCore::FrameLoader::finishedParsing):
1412         (WebCore::FrameLoader::completed):
1413         * page/FrameView.cpp:
1414         (WebCore::FrameView::resetScrollbarsAndClearContentsSize):
1415         (WebCore::FrameView::scrollToAnchor):
1416         (WebCore::FrameView::maintainScrollPositionAtAnchor):
1417         (WebCore::FrameView::setScrollPosition):
1418         (WebCore::FrameView::autoSizeIfEnabled):
1419         (WebCore::FrameView::setWasScrolledByUser):
1420         * page/LayoutContext.cpp:
1421         (WebCore::LayoutContext::layout):
1422         * page/Page.cpp:
1423         (WebCore::Page::setPageScaleFactor):
1424         * page/ViewportConfiguration.cpp:
1425         (WebCore::ViewportConfiguration::setContentsSize):
1426         (WebCore::ViewportConfiguration::setViewportArguments):
1427         (WebCore::ViewportConfiguration::updateConfiguration):
1428         (WebCore::operator<<):
1429         (WebCore::ViewportConfiguration::description const):
1430         (WebCore::ViewportConfiguration::dump const):
1431         * page/ViewportConfiguration.h:
1432         * platform/Logging.h:
1433         * platform/ScrollView.cpp:
1434         (WebCore::ScrollView::setFixedLayoutSize):
1435
1436 2017-12-01  Alicia Boya García  <aboya@igalia.com>
1437
1438         [MSE] Use correct range end checks in sourceBufferPrivateDidReceiveSample()
1439         https://bugs.webkit.org/show_bug.cgi?id=179690
1440
1441         Reviewed by Jer Noble.
1442
1443         The Coded Frame Processing algorithm as defined in
1444         https://www.w3.org/TR/media-source/#sourcebuffer-coded-frame-processing states:
1445
1446         1.14. Remove existing coded frames in track buffer:
1447          -> If highest end timestamp for track buffer is not set:
1448                [...]
1449          -> If highest end timestamp for track buffer is set and less than or
1450             equal to presentation timestamp:
1451                Remove all coded frames from track buffer that have a
1452                presentation timestamp greater than or equal to highest end
1453                timestamp and less than frame end timestamp.
1454
1455         Note the removal range is closed-open [a, b). WebKit is actually removing
1456         frames using an open-closed range (a, b], which causes frames not to be removed
1457         in situations where they should and frames to be removed in situations when
1458         they should not.
1459
1460         Tests: media/media-source/media-source-range-end-frame-not-removed.html
1461                media/media-source/media-source-range-start-frame-replaced.html
1462
1463         * Modules/mediasource/SampleMap.cpp:
1464         (WebCore::PresentationOrderSampleMap::findSamplesBetweenPresentationTimesFromEnd):
1465         * Modules/mediasource/SampleMap.h:
1466         * Modules/mediasource/SourceBuffer.cpp:
1467         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1468
1469 2017-12-01  Simon Fraser  <simon.fraser@apple.com>
1470
1471         Reduce the number of calls to ViewportConfiguration::updateConfiguration()
1472         https://bugs.webkit.org/show_bug.cgi?id=180299
1473
1474         Reviewed by Zalan Bujtas.
1475
1476         There are several calls to ViewportConfiguration::setDefaultConfiguration() during loading
1477         with the same arguments. We can avoid unnecessary calls to updateConfiguration() by returning
1478         early if the configuration hasn't changed.
1479
1480         * page/ViewportConfiguration.cpp:
1481         (WebCore::ViewportConfiguration::setDefaultConfiguration):
1482         * page/ViewportConfiguration.h:
1483         (WebCore::ViewportConfiguration::Parameters::operator== const):
1484
1485 2017-12-01  Aishwarya Nirmal  <anirmal@apple.com>
1486
1487         [Touch Bar Web API] Object representing Touch Bar Menu to send between Web and UI Processes
1488         https://bugs.webkit.org/show_bug.cgi?id=179714
1489
1490         Reviewed by Wenson Hsieh.
1491
1492         These changes allow the HTMLMenuElement and HTMLMenuItemElement to parse attributes relating
1493         to the touch bar and convey changes to the elements that will eventually be propogated to the
1494         UI process.
1495
1496         No new tests at this point because the changes to HTMLMenuElement and HTMLMenuItemElement are
1497         new properties, which might not be worth testing, and overriden methods for insertedIntoAncestor
1498         and removedFromAncestor, which are involved in sending a message to a UI process but might be
1499         difficult to test at this point since the UI process only receives (and does not yet process)
1500         the message.
1501
1502         * html/HTMLMenuElement.cpp:
1503         (WebCore::HTMLMenuElement::insertedIntoAncestor):
1504         (WebCore::HTMLMenuElement::removedFromAncestor):
1505         (WebCore::HTMLMenuElement::parseAttribute):
1506         * html/HTMLMenuElement.h:
1507         * html/HTMLMenuItemElement.cpp:
1508         (WebCore::HTMLMenuItemElement::insertedIntoAncestor):
1509         (WebCore::HTMLMenuItemElement::removedFromAncestor):
1510         * html/HTMLMenuItemElement.h:
1511         * page/ChromeClient.h:
1512
1513 2017-12-01  Daniel Bates  <dabates@apple.com>
1514
1515         AlternativePresentationButtonSubstitution::unapply() may not undo substitution
1516         https://bugs.webkit.org/show_bug.cgi?id=180279
1517         <rdar://problem/35800599>
1518
1519         Reviewed by Simon Fraser.
1520
1521         Fixes an issue where removing an alternative presentation button substituted for a non-HTML input
1522         element did not restore the original appearance of the element before the substitution.
1523
1524         To substitute the alternative presentation button for a non-HTML input element we attach a
1525         user-agent shadow root to it. Adding a shadow root, including a user-agent shadow root,
1526         tears down the existing renderers for the element. Currently when we unapply such a substitution
1527         we ultimately just remove the shadow root and do not create new renderers for the subtree
1528         that the shadow root was removed from. We need to create new renderers for this subtree
1529         to restore the original appearance of the element before the substitution.
1530
1531         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
1532         (WebCore::AlternativePresentationButtonSubstitution::unapply):
1533
1534 2017-12-01  Christopher Reid  <chris.reid@sony.com>
1535
1536         Move DateComponents into WTF
1537         https://bugs.webkit.org/show_bug.cgi?id=180211
1538
1539         Reviewed by Myles C. Maxfield.
1540
1541         No new tests no change in behavior.
1542
1543         Moved DateComponents from platform into WTF.
1544
1545         * Sources.txt: Removed DateComponents
1546         * WebCore.xcodeproj/project.pbxproj: Removed DateComponents
1547         * dom/Document.cpp:
1548         * html/BaseDateAndTimeInputType.h:
1549         * html/DateTimeInputType.h: Fixed a call to the wrong parent constructor
1550         * html/HTMLInputElement.h:
1551         * html/InputType.cpp:
1552         * html/InputType.h:
1553         * platform/text/PlatformLocale.cpp:
1554         * platform/text/PlatformLocale.h:
1555         * platform/text/ios/LocalizedDateCache.h:
1556         * platform/text/mac/LocaleMac.h:
1557         * platform/text/win/LocaleWin.cpp:
1558         * platform/text/win/LocaleWin.h:
1559         * rendering/RenderThemeIOS.mm:
1560
1561 2017-12-01  Daniel Bates  <dabates@apple.com>
1562
1563         Alternative Presentation Button: Provide a way to query for the replaced elements
1564         https://bugs.webkit.org/show_bug.cgi?id=180114
1565         <rdar://problem/35710539>
1566
1567         Reviewed by Tim Horton.
1568
1569         Add SPI to query for the elements that were replaced by an Alternative Presentation Button.
1570
1571         Test: fast/forms/alternative-presentation-button/replaced-elements.html
1572
1573         * editing/Editor.cpp:
1574         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Added.
1575         * editing/Editor.h:
1576         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp:
1577         (WebCore::AlternativePresentationButtonSubstitution::replacedElements): Added.
1578         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
1579         * testing/Internals.cpp:
1580         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Added.
1581         * testing/Internals.h:
1582         * testing/Internals.idl: Expose internals function elementsReplacedByAlternativePresentationButton()
1583         so as to test Editor::elementsReplacedByAlternativePresentationButton().
1584
1585 2017-12-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
1586
1587         Rename ImageFrameCache to ImageSource
1588         https://bugs.webkit.org/show_bug.cgi?id=180172
1589
1590         Reviewed by Per Arne Vollan.
1591
1592         This is a follow-up for r225300. ImageSource is the intended name after
1593         merging ImageFrameCache and ImageSource.
1594
1595         * Sources.txt:
1596         * WebCore.xcodeproj/project.pbxproj:
1597         * platform/graphics/BitmapImage.cpp:
1598         (WebCore::BitmapImage::BitmapImage):
1599         * platform/graphics/BitmapImage.h:
1600         * platform/graphics/ImageFrame.h:
1601         * platform/graphics/ImageFrameCache.cpp: Removed.
1602         * platform/graphics/ImageFrameCache.h: Removed.
1603         * platform/graphics/ImageSource.cpp: Added.
1604         (WebCore::ImageSource::ImageSource):
1605         (WebCore::ImageSource::~ImageSource):
1606         (WebCore::ImageSource::ensureDecoderAvailable):
1607         (WebCore::ImageSource::setData):
1608         (WebCore::ImageSource::resetData):
1609         (WebCore::ImageSource::dataChanged):
1610         (WebCore::ImageSource::isAllDataReceived):
1611         (WebCore::ImageSource::destroyDecodedData):
1612         (WebCore::ImageSource::destroyIncompleteDecodedData):
1613         (WebCore::ImageSource::clearFrameBufferCache):
1614         (WebCore::ImageSource::decodedSizeChanged):
1615         (WebCore::ImageSource::decodedSizeIncreased):
1616         (WebCore::ImageSource::decodedSizeDecreased):
1617         (WebCore::ImageSource::decodedSizeReset):
1618         (WebCore::ImageSource::didDecodeProperties):
1619         (WebCore::ImageSource::growFrames):
1620         (WebCore::ImageSource::setNativeImage):
1621         (WebCore::ImageSource::cacheMetadataAtIndex):
1622         (WebCore::ImageSource::cacheNativeImageAtIndex):
1623         (WebCore::ImageSource::cacheNativeImageAtIndexAsync):
1624         (WebCore::ImageSource::decodingQueue):
1625         (WebCore::ImageSource::frameRequestQueue):
1626         (WebCore::ImageSource::canUseAsyncDecoding):
1627         (WebCore::ImageSource::startAsyncDecodingQueue):
1628         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
1629         (WebCore::ImageSource::isAsyncDecodingQueueIdle const):
1630         (WebCore::ImageSource::stopAsyncDecodingQueue):
1631         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
1632         (WebCore::ImageSource::clearMetadata):
1633         (WebCore::ImageSource::sourceURL const):
1634         (WebCore::ImageSource::mimeType const):
1635         (WebCore::ImageSource::expectedContentLength const):
1636         (WebCore::ImageSource::metadata):
1637         (WebCore::ImageSource::frameMetadataAtIndex):
1638         (WebCore::ImageSource::frameMetadataAtIndexCacheIfNeeded):
1639         (WebCore::ImageSource::encodedDataStatus):
1640         (WebCore::ImageSource::frameCount):
1641         (WebCore::ImageSource::repetitionCount):
1642         (WebCore::ImageSource::uti):
1643         (WebCore::ImageSource::filenameExtension):
1644         (WebCore::ImageSource::hotSpot):
1645         (WebCore::ImageSource::size):
1646         (WebCore::ImageSource::sizeRespectingOrientation):
1647         (WebCore::ImageSource::singlePixelSolidColor):
1648         (WebCore::ImageSource::maximumSubsamplingLevel):
1649         (WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex):
1650         (WebCore::ImageSource::frameDecodingStatusAtIndex):
1651         (WebCore::ImageSource::frameHasAlphaAtIndex):
1652         (WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex):
1653         (WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex):
1654         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
1655         (WebCore::ImageSource::frameSizeAtIndex):
1656         (WebCore::ImageSource::frameBytesAtIndex):
1657         (WebCore::ImageSource::frameDurationAtIndex):
1658         (WebCore::ImageSource::frameOrientationAtIndex):
1659         (WebCore::ImageSource::setTargetContext):
1660         (WebCore::ImageSource::createFrameImageAtIndex):
1661         (WebCore::ImageSource::frameImageAtIndex):
1662         (WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
1663         (WebCore::ImageSource::dump):
1664         * platform/graphics/ImageSource.h: Added.
1665         (WebCore::ImageSource::create):
1666         (WebCore::ImageSource::decodedSize const):
1667         (WebCore::ImageSource::destroyAllDecodedData):
1668         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
1669         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
1670         (WebCore::ImageSource::clearImage):
1671         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
1672         (WebCore::ImageSource::hasAsyncDecodingQueue const):
1673         (WebCore::ImageSource::isSizeAvailable):
1674         (WebCore::ImageSource::isDecoderAvailable const):
1675         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
1676         (WebCore::ImageSource::ImageFrameRequest::operator== const):
1677         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1678         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
1679         * platform/graphics/cg/GraphicsContext3DCG.cpp:
1680         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
1681
1682 2017-12-01  Youenn Fablet  <youenn@apple.com>
1683
1684         Implement https://w3c.github.io/ServiceWorker/#clients-get
1685         https://bugs.webkit.org/show_bug.cgi?id=180167
1686
1687         Reviewed by Chris Dumez.
1688
1689         Test: http/tests/workers/service/serviceworkerclients-get.https.html
1690
1691         Implement clients get by having service worker clients do the following:
1692         - Go to main thread to query the SWClientConnection for getting the client.
1693         - SWClientConnection requests it through IPC to StorageProcess SWServer.
1694         - SWServer looks at its client map and returns client data based on the given identifier.
1695         - SWClientConnection sends it back to the right clients for resolving the promise.
1696
1697         Identifier is parsed at service worker process level.
1698
1699         Made ServiceWorkerClients no longer an ActiveDOMObject since it is owned by ServiceWorkerGlobalScope
1700         and is only exposed in service workers.
1701
1702         * workers/service/ServiceWorkerClientIdentifier.h:
1703         (WebCore::ServiceWorkerClientIdentifier::fromString):
1704         * workers/service/ServiceWorkerClients.cpp:
1705         (WebCore::ServiceWorkerClients::ServiceWorkerClients):
1706         (WebCore::ServiceWorkerClients::get):
1707         * workers/service/ServiceWorkerClients.h:
1708         (WebCore::ServiceWorkerClients::create):
1709         * workers/service/context/SWContextManager.cpp:
1710         (WebCore::SWContextManager::postTaskToServiceWorker):
1711         * workers/service/context/SWContextManager.h:
1712         * workers/service/server/SWServer.cpp:
1713         (WebCore::SWServer::getClientFromId):
1714         * workers/service/server/SWServer.h:
1715         * workers/service/server/SWServerToContextConnection.cpp:
1716         (WebCore::SWServerToContextConnection::findClientByIdentifier):
1717         * workers/service/server/SWServerToContextConnection.h:
1718         * workers/service/server/SWServerWorker.cpp:
1719         (WebCore::SWServerWorker::origin const):
1720         (WebCore::SWServerWorker::findClientByIdentifier):
1721         * workers/service/server/SWServerWorker.h:
1722
1723 2017-12-01  Brian Burg  <bburg@apple.com>
1724
1725         Web Inspector: move Inspector::Protocol::Array<T> to JSON namespace
1726         https://bugs.webkit.org/show_bug.cgi?id=173662
1727
1728         Reviewed by Joseph Pecoraro.
1729
1730         Adopt new type names.
1731
1732         * inspector/InspectorCanvas.cpp:
1733         (WebCore::InspectorCanvas::recordAction):
1734         (WebCore::InspectorCanvas::releaseFrames):
1735         (WebCore::InspectorCanvas::releaseData):
1736         (WebCore::InspectorCanvas::indexForData):
1737         (WebCore::buildArrayForAffineTransform):
1738         (WebCore::buildArrayForVector):
1739         (WebCore::InspectorCanvas::buildInitialState):
1740         (WebCore::InspectorCanvas::buildAction):
1741         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
1742         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
1743         (WebCore::InspectorCanvas::buildArrayForImageData):
1744         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
1745         * inspector/InspectorCanvas.h:
1746         * inspector/InspectorController.cpp:
1747         (WebCore::InspectorController::buildObjectForHighlightedNodes const):
1748         * inspector/InspectorController.h:
1749         * inspector/InspectorOverlay.cpp:
1750         (WebCore::buildObjectForHighlight):
1751         (WebCore::InspectorOverlay::drawPaintRects):
1752         (WebCore::buildArrayForRendererFragments):
1753         (WebCore::buildObjectForElementData):
1754         (WebCore::InspectorOverlay::buildHighlightObjectForNode const):
1755         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const):
1756         * inspector/InspectorOverlay.h:
1757         * inspector/InspectorStyleSheet.cpp:
1758         (WebCore::fillMediaListChain):
1759         (WebCore::InspectorStyle::buildArrayForComputedStyle const):
1760         (WebCore::InspectorStyle::styleWithProperties const):
1761         (WebCore::buildObjectForSelectorHelper):
1762         (WebCore::selectorsFromSource):
1763         (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
1764         (WebCore::InspectorStyleSheet::buildObjectForRule):
1765         (WebCore::InspectorStyleSheet::buildObjectForStyle):
1766         (WebCore::InspectorStyleSheet::buildArrayForRuleList):
1767         * inspector/InspectorStyleSheet.h:
1768         * inspector/agents/InspectorApplicationCacheAgent.cpp:
1769         (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
1770         (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources):
1771         * inspector/agents/InspectorApplicationCacheAgent.h:
1772         * inspector/agents/InspectorCSSAgent.cpp:
1773         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
1774         (WebCore::InspectorCSSAgent::getComputedStyleForNode):
1775         (WebCore::InspectorCSSAgent::getAllStyleSheets):
1776         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
1777         (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames):
1778         (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
1779         * inspector/agents/InspectorCSSAgent.h:
1780         * inspector/agents/InspectorCanvasAgent.cpp:
1781         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1782         * inspector/agents/InspectorCanvasAgent.h:
1783         * inspector/agents/InspectorDOMAgent.cpp:
1784         (WebCore::InspectorDOMAgent::querySelectorAll):
1785         (WebCore::InspectorDOMAgent::pushNodePathToFrontend):
1786         (WebCore::InspectorDOMAgent::getEventListenersForNode):
1787         (WebCore::InspectorDOMAgent::getSearchResults):
1788         (WebCore::InspectorDOMAgent::getAttributes):
1789         (WebCore::InspectorDOMAgent::buildObjectForNode):
1790         (WebCore::InspectorDOMAgent::buildArrayForElementAttributes):
1791         (WebCore::InspectorDOMAgent::buildArrayForContainerChildren):
1792         (WebCore::InspectorDOMAgent::buildArrayForPseudoElements):
1793         (WebCore::InspectorDOMAgent::processAccessibilityChildren):
1794         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
1795         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
1796         * inspector/agents/InspectorDOMAgent.h:
1797         * inspector/agents/InspectorDOMStorageAgent.cpp:
1798         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
1799         * inspector/agents/InspectorDOMStorageAgent.h:
1800         * inspector/agents/InspectorDatabaseAgent.cpp:
1801         (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
1802         * inspector/agents/InspectorDatabaseAgent.h:
1803         * inspector/agents/InspectorIndexedDBAgent.cpp:
1804         (WebCore::Inspector::keyPathFromIDBKeyPath):
1805         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
1806         * inspector/agents/InspectorLayerTreeAgent.cpp:
1807         (WebCore::InspectorLayerTreeAgent::layersForNode):
1808         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy):
1809         (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderLayerHierarchy):
1810         * inspector/agents/InspectorLayerTreeAgent.h:
1811         * inspector/agents/InspectorMemoryAgent.cpp:
1812         (WebCore::InspectorMemoryAgent::collectSample):
1813         * inspector/agents/InspectorNetworkAgent.cpp:
1814         (WebCore::InspectorNetworkAgent::searchOtherRequests):
1815         (WebCore::InspectorNetworkAgent::searchInRequest):
1816         * inspector/agents/InspectorNetworkAgent.h:
1817         * inspector/agents/InspectorPageAgent.cpp:
1818         (WebCore::buildArrayForCookies):
1819         (WebCore::InspectorPageAgent::getCookies):
1820         (WebCore::InspectorPageAgent::searchInResource):
1821         (WebCore::InspectorPageAgent::searchInResources):
1822         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
1823         * inspector/agents/InspectorPageAgent.h:
1824         * inspector/agents/WebConsoleAgent.cpp:
1825         (WebCore::WebConsoleAgent::getLoggingChannels):
1826         * inspector/agents/WebConsoleAgent.h:
1827
1828 2017-12-01  Wenson Hsieh  <wenson_hsieh@apple.com>
1829
1830         [Attachment Support] Implement SPI for clients to update a given attachment's data
1831         https://bugs.webkit.org/show_bug.cgi?id=180184
1832         <rdar://problem/35355731>
1833
1834         Reviewed by Tim Horton.
1835
1836         Add native API support for Mail to update the data (and optionally, the name and type) of a given attachment
1837         element. See per-method comments below for more detail.
1838
1839         Test: WKAttachmentTests.ChangeAttachmentDataAndFileInformation
1840               WKAttachmentTests.ChangeAttachmentDataUpdatesWithInPlaceDisplay
1841
1842         * editing/Editor.cpp:
1843         (WebCore::Editor::insertAttachment):
1844         * html/HTMLAttachmentElement.cpp:
1845         (WebCore::HTMLAttachmentElement::setFile):
1846         (WebCore::HTMLAttachmentElement::invalidateShadowRootChildrenIfNecessary):
1847
1848         Pull out logic to hide and reset shadow DOM state into a separate helper, and additionally hide both the image
1849         and video child elements if they exist. This prevents us from getting into a state where both image and video
1850         elements may appear side-by-side when changing data from an image to a video or vice versa.
1851
1852         (WebCore::HTMLAttachmentElement::updateFileWithData):
1853
1854         Add a new helper to update the backing File of an attachment element from data, optionally updating the filename
1855         and content type as well.
1856
1857         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
1858         * html/HTMLAttachmentElement.h:
1859
1860 2017-12-01  Chris Dumez  <cdumez@apple.com>
1861
1862         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration()
1863         https://bugs.webkit.org/show_bug.cgi?id=180263
1864
1865         Reviewed by Youenn Fablet.
1866
1867         Get rid of microtask in ServiceWorkerContainer::jobResolvedWithRegistration(). It
1868         is no longer needed and MicrotaskQueue::mainThreadQueue() is only safe to use from
1869         the main thread, as its name suggest. ServiceWorkerContainer are also instantiated
1870         in Service worker threads nowadays.
1871
1872         * workers/service/SWClientConnection.cpp:
1873         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1874         * workers/service/ServiceWorkerContainer.cpp:
1875         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1876         * workers/service/ServiceWorkerContainer.h:
1877         * workers/service/ServiceWorkerJob.cpp:
1878         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
1879         * workers/service/ServiceWorkerJob.h:
1880         * workers/service/ServiceWorkerJobClient.h:
1881
1882 2017-12-01  Myles C. Maxfield  <mmaxfield@apple.com>
1883
1884         Free FontFaceSets may include fonts that were never actually added to them
1885         https://bugs.webkit.org/show_bug.cgi?id=180164
1886
1887         Reviewed by Simon Fraser.
1888
1889         There are two circumstances where this can occur:
1890
1891         - If script makes a so-called "free" FontFaceSet, by using "new FontFaceSet". This object is not
1892         associated with the document, and should therefore only include fonts which have been manually
1893         added to it from script. However, today, this object includes preinstalled fonts which have the
1894         same names as any fonts manually added to it. (So, if you manually add "Helvetica", the object
1895         would have two objects - the one you just added and the preinstalled version too).
1896
1897         - For the document's FontFaceSet, the same thing would happen. This one is a little trickier
1898         because the spec is not clear whether or not the document's FontFaceSet should include these
1899         preinstalled fonts. However, running this test in Firefox and Chrome, they both agree that 
1900         preinstalled fonts should not be present, so this patch adheres to this behavior.
1901
1902         We can't actually remove the preinstalled fonts from the document's FontFaceSet (because that's
1903         how normal font lookups are performed), but we can filter them out at the point they meet the
1904         Javascript API. And, for "free" FontFaceSets, we can avoid adding them in the first place for
1905         performance.
1906
1907         Test: fast/text/font-face-api-preinstalled.html
1908
1909         * css/CSSFontFaceSet.cpp:
1910         (WebCore::CSSFontFaceSet::CSSFontFaceSet):
1911         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1912         (WebCore::CSSFontFaceSet::addToFacesLookupTable):
1913         (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
1914         (WebCore::CSSFontFaceSet::check):
1915         (WebCore::CSSFontFaceSet::matchingFaces): Deleted.
1916         * css/CSSFontFaceSet.h:
1917         * css/CSSFontSelector.cpp:
1918         (WebCore::CSSFontSelector::CSSFontSelector):
1919         * css/FontFaceSet.cpp:
1920         (WebCore::FontFaceSet::load):
1921
1922 2017-12-01  Dean Jackson  <dino@apple.com>
1923
1924         Attempted build fix.
1925
1926         * platform/graphics/ANGLEWebKitBridge.cpp:
1927         (WebCore::ANGLEWebKitBridge::compileShaderSource):
1928         * platform/graphics/ANGLEWebKitBridge.h:
1929         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1930         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
1931
1932 2017-12-01  Dean Jackson  <dino@apple.com>
1933
1934         Use SH_INITIALIZE_UNINITIALIZED_LOCALS now that ANGLE has been updated
1935         https://bugs.webkit.org/show_bug.cgi?id=177929
1936         <rdar://problem/34866210>
1937
1938         Reviewed by Sam Weinig.
1939
1940         Test: fast/canvas/webgl/uninitialized-locals.html
1941
1942         * platform/graphics/ANGLEWebKitBridge.cpp:
1943         (WebCore::ANGLEWebKitBridge::compileShaderSource):
1944         * platform/graphics/ANGLEWebKitBridge.h:
1945         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1946         (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
1947
1948 2017-12-01  Youenn Fablet  <youenn@apple.com>
1949
1950         Many imported/w3c/web-platform-tests/service-workers/ test are failing together intermittently
1951         https://bugs.webkit.org/show_bug.cgi?id=180227
1952
1953         Reviewed by Mark Lam.
1954
1955         No observable change.
1956
1957         * bindings/js/JSDOMPromise.cpp:
1958         (WebCore::callFunction):
1959
1960 2017-12-01  Brady Eidson  <beidson@apple.com>
1961
1962         Add Internals.terminateServiceWorker, and the ability to restart service workers for postMessage.
1963         https://bugs.webkit.org/show_bug.cgi?id=180170
1964
1965         Reviewed by Chris Dumez.
1966
1967         Test: http/tests/workers/service/postmessage-after-terminate.https.html
1968
1969         * dom/ActiveDOMObject.cpp:
1970         (WebCore::ActiveDOMObject::~ActiveDOMObject):
1971
1972         * testing/Internals.cpp:
1973         (WebCore::Internals::terminateServiceWorker):
1974         * testing/Internals.h:
1975         * testing/Internals.idl:
1976
1977         * workers/service/SWClientConnection.h:
1978
1979         * workers/service/ServiceWorker.idl:
1980
1981         * workers/service/context/SWContextManager.cpp:
1982         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
1983         (WebCore::SWContextManager::terminateWorker):
1984         * workers/service/context/SWContextManager.h:
1985
1986         * workers/service/context/ServiceWorkerThreadProxy.h:
1987
1988         * workers/service/server/SWServer.cpp:
1989         (WebCore::SWServer::workerByID const):
1990         (WebCore::SWServer::Connection::syncTerminateWorker):
1991         (WebCore::SWServer::installContextData):
1992         (WebCore::SWServer::invokeRunServiceWorker):
1993         (WebCore::SWServer::terminateWorker):
1994         (WebCore::SWServer::syncTerminateWorker):
1995         (WebCore::SWServer::terminateWorkerInternal):
1996         (WebCore::SWServer::workerContextTerminated):
1997         * workers/service/server/SWServer.h:
1998         (WebCore::SWServer::workerByID const): Deleted.
1999
2000         * workers/service/server/SWServerToContextConnection.h:
2001
2002         * workers/service/server/SWServerWorker.cpp:
2003         (WebCore::SWServerWorker::contextData const):
2004         * workers/service/server/SWServerWorker.h:
2005         (WebCore::SWServerWorker::isRunning const):
2006         (WebCore::SWServerWorker::isTerminating const):
2007         (WebCore::SWServerWorker::setState):
2008         (WebCore::SWServerWorker::server):
2009
2010 2017-12-01  Zalan Bujtas  <zalan@apple.com>
2011
2012         Nullptr deref in WebCore::RenderTableCaption::containingBlockLogicalWidthForContent
2013         https://bugs.webkit.org/show_bug.cgi?id=180251
2014         <rdar://problem/34138562>
2015
2016         Reviewed by Simon Fraser.
2017
2018         containingBlockLogicalWidthForContent should check whether the renderer is actually
2019         attached to the tree.
2020
2021         Test: fast/table/caption-crash-when-layer-backed.html
2022
2023         * rendering/RenderBoxModelObject.cpp:
2024         (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent const):
2025         * rendering/RenderTableCaption.h:
2026         (WebCore::RenderTableCaption::containingBlockLogicalWidthForContent const):
2027
2028 2017-12-01  Youenn Fablet  <youenn@apple.com>
2029
2030         Clear WebSWClientConnection in case storage process IPC connection is closing
2031         https://bugs.webkit.org/show_bug.cgi?id=180210
2032
2033         Reviewed by Chris Dumez.
2034
2035         No observable change of behavior.
2036
2037         * dom/Document.h: Keeping a ref since object may be deleted otherwise.
2038
2039 2017-12-01  Chris Dumez  <cdumez@apple.com>
2040
2041         Drop clientCreationURL from ServiceWorkerRegistrationKey
2042         https://bugs.webkit.org/show_bug.cgi?id=180255
2043
2044         Reviewed by Youenn Fablet.
2045
2046         Drop clientCreationURL from ServiceWorkerRegistrationKey. It is not needed and leads to
2047         wrong behavior when using the Service Worker API from inside service workers.
2048
2049         * workers/service/ServiceWorkerJobData.cpp:
2050         (WebCore::ServiceWorkerJobData::registrationKey const):
2051         * workers/service/ServiceWorkerRegistrationKey.cpp:
2052         (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey):
2053         (WebCore::ServiceWorkerRegistrationKey::hash const):
2054         (WebCore::ServiceWorkerRegistrationKey::operator== const):
2055         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
2056         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
2057         * workers/service/ServiceWorkerRegistrationKey.h:
2058         (WebCore::ServiceWorkerRegistrationKey::scope const):
2059         (WebCore::ServiceWorkerRegistrationKey::setScope):
2060         (WebCore::ServiceWorkerRegistrationKey::encode const):
2061         (WebCore::ServiceWorkerRegistrationKey::decode):
2062         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
2063         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
2064         (WebCore::ServiceWorkerRegistrationKey::clientCreationURL const): Deleted.
2065         (WebCore::ServiceWorkerRegistrationKey::setClientCreationURL): Deleted.
2066
2067 2017-12-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2068
2069         [WinCairo] Wrongly placed scroll bars in HiDPI
2070         https://bugs.webkit.org/show_bug.cgi?id=180066
2071
2072         Reviewed by Žan Doberšek.
2073
2074         PlatformContextCairo wasn't properly initialized. It should have a
2075         pointer to GraphicsContextPrivate in WinCairo port to paint
2076         controls in right places.
2077
2078         No new tests, no behavior change.
2079
2080         * platform/graphics/win/GraphicsContextCairoWin.cpp:
2081         (WebCore::GraphicsContext::platformInit): Call PlatformContextCairo::setGraphicsContextPrivate.
2082
2083 2017-12-01  Eric Carlson  <eric.carlson@apple.com>
2084
2085         [MediaStream] Use CaptureDevice instead of device ID to identify devices
2086         https://bugs.webkit.org/show_bug.cgi?id=180206
2087         <rdar://problem/35775758>
2088
2089         Reviewed by Youenn Fablet.
2090
2091         No new tests, no change in behavior.
2092
2093         * Modules/mediastream/UserMediaRequest.cpp:
2094         (WebCore::UserMediaRequest::allow):
2095         * Modules/mediastream/UserMediaRequest.h:
2096         (WebCore::UserMediaRequest::allowedAudioDeviceUID const): Deleted.
2097         (WebCore::UserMediaRequest::allowedVideoDeviceUID const): Deleted.
2098         * platform/mediastream/RealtimeMediaSource.h:
2099         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2100         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
2101         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
2102         * platform/mediastream/RealtimeMediaSourceCenter.h:
2103         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2104         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2105         * platform/mock/MockRealtimeAudioSource.cpp:
2106         * platform/mock/MockRealtimeVideoSource.cpp:
2107
2108 2017-11-30  Alex Christensen  <achristensen@webkit.org>
2109
2110         Extra PerformanceEntryList entry after iframe navigation
2111         https://bugs.webkit.org/show_bug.cgi?id=178433
2112
2113         Reviewed by Joseph Pecoraro.
2114
2115         Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html
2116
2117         When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
2118         Subsequent main resource loads should not.
2119
2120         * loader/FrameLoader.h:
2121         (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
2122         * loader/ResourceTimingInformation.cpp:
2123         (WebCore::ResourceTimingInformation::addResourceTiming):
2124
2125 2017-11-30  Zalan Bujtas  <zalan@apple.com>
2126
2127         [Simple line layout] Incorrect repaint rect with vertically shrinking content and bottom-padding.
2128         https://bugs.webkit.org/show_bug.cgi?id=180223
2129         <rdar://problem/34122210>
2130
2131         Reviewed by Simon Fraser.
2132
2133         Repaint rect should be extended all the way to bottom border/padding.
2134
2135         Test: fast/repaint/simple-line-layout-shrinking-content.html
2136
2137         * rendering/RenderBlockFlow.cpp:
2138         (WebCore::RenderBlockFlow::layoutSimpleLines):
2139
2140 2017-11-30  Stephan Szabo  <stephan.szabo@sony.com>
2141
2142         Make LegacyCustomProtocolManager optional for network process
2143         https://bugs.webkit.org/show_bug.cgi?id=176230
2144
2145         Reviewed by Alex Christensen.
2146
2147         No new tests, only sets up feature define
2148
2149         * Configurations/FeatureDefines.xcconfig:
2150
2151 2017-11-30  Joseph Pecoraro  <pecoraro@apple.com>
2152
2153         [Cocoa] Fix CVPixelBuffer leak
2154         https://bugs.webkit.org/show_bug.cgi?id=180224
2155
2156         Reviewed by Youenn Fablet.
2157
2158         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
2159         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
2160         Adopt the newly created pixel buffer.
2161
2162         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2163         Release the format description as soon as we are done with it. Otherwise
2164         we could have bailed before releasing it.
2165
2166 2017-11-30  Simon Fraser  <simon.fraser@apple.com>
2167
2168         Improve filter logging
2169         https://bugs.webkit.org/show_bug.cgi?id=180182
2170
2171         Reviewed by Sam Weinig.
2172
2173         Add a parameter to FilterEffect::externalRepresentation() so that we can log extra
2174         data without breaking layout tests.
2175
2176         Add TextStream output for ColorSpace.
2177         
2178         Improve logging of FEComponentTransfer ComponentTransferFunctions by logging the data
2179         that's appropriate for the function type, and rebaseline affected tests.
2180
2181         * platform/graphics/Color.cpp:
2182         (WebCore::operator<<):
2183         * platform/graphics/Color.h:
2184         * platform/graphics/filters/FEBlend.cpp:
2185         (WebCore::FEBlend::externalRepresentation const):
2186         * platform/graphics/filters/FEBlend.h:
2187         * platform/graphics/filters/FEColorMatrix.cpp:
2188         (WebCore::FEColorMatrix::externalRepresentation const):
2189         * platform/graphics/filters/FEColorMatrix.h:
2190         * platform/graphics/filters/FEComponentTransfer.cpp:
2191         (WebCore::operator<<):
2192         (WebCore::FEComponentTransfer::externalRepresentation const):
2193         * platform/graphics/filters/FEComponentTransfer.h:
2194         * platform/graphics/filters/FEComposite.cpp:
2195         (WebCore::FEComposite::externalRepresentation const):
2196         * platform/graphics/filters/FEComposite.h:
2197         * platform/graphics/filters/FEConvolveMatrix.cpp:
2198         (WebCore::FEConvolveMatrix::externalRepresentation const):
2199         * platform/graphics/filters/FEConvolveMatrix.h:
2200         * platform/graphics/filters/FEDiffuseLighting.cpp:
2201         (WebCore::FEDiffuseLighting::externalRepresentation const):
2202         * platform/graphics/filters/FEDiffuseLighting.h:
2203         * platform/graphics/filters/FEDisplacementMap.cpp:
2204         (WebCore::FEDisplacementMap::externalRepresentation const):
2205         * platform/graphics/filters/FEDisplacementMap.h:
2206         * platform/graphics/filters/FEDropShadow.cpp:
2207         (WebCore::FEDropShadow::externalRepresentation const):
2208         * platform/graphics/filters/FEDropShadow.h:
2209         * platform/graphics/filters/FEFlood.cpp:
2210         (WebCore::FEFlood::externalRepresentation const):
2211         * platform/graphics/filters/FEFlood.h:
2212         * platform/graphics/filters/FEGaussianBlur.cpp:
2213         (WebCore::FEGaussianBlur::externalRepresentation const):
2214         * platform/graphics/filters/FEGaussianBlur.h:
2215         * platform/graphics/filters/FEMerge.cpp:
2216         (WebCore::FEMerge::externalRepresentation const):
2217         * platform/graphics/filters/FEMerge.h:
2218         * platform/graphics/filters/FEMorphology.cpp:
2219         (WebCore::FEMorphology::externalRepresentation const):
2220         * platform/graphics/filters/FEMorphology.h:
2221         * platform/graphics/filters/FEOffset.cpp:
2222         (WebCore::FEOffset::externalRepresentation const):
2223         * platform/graphics/filters/FEOffset.h:
2224         * platform/graphics/filters/FESpecularLighting.cpp:
2225         (WebCore::FESpecularLighting::externalRepresentation const):
2226         * platform/graphics/filters/FESpecularLighting.h:
2227         * platform/graphics/filters/FETile.cpp:
2228         (WebCore::FETile::externalRepresentation const):
2229         * platform/graphics/filters/FETile.h:
2230         * platform/graphics/filters/FETurbulence.cpp:
2231         (WebCore::FETurbulence::externalRepresentation const):
2232         * platform/graphics/filters/FETurbulence.h:
2233         * platform/graphics/filters/FilterEffect.cpp:
2234         (WebCore::FilterEffect::externalRepresentation const):
2235         (WebCore::operator<<):
2236         * platform/graphics/filters/FilterEffect.h:
2237         * platform/graphics/filters/SourceAlpha.cpp:
2238         (WebCore::SourceAlpha::externalRepresentation const):
2239         * platform/graphics/filters/SourceAlpha.h:
2240         * platform/graphics/filters/SourceGraphic.cpp:
2241         (WebCore::SourceGraphic::externalRepresentation const):
2242         * platform/graphics/filters/SourceGraphic.h:
2243         * rendering/svg/RenderSVGResourceFilter.cpp:
2244         (WebCore::RenderSVGResourceFilter::applyResource):
2245         * svg/graphics/filters/SVGFEImage.cpp:
2246         (WebCore::FEImage::externalRepresentation const):
2247         * svg/graphics/filters/SVGFEImage.h:
2248
2249 2017-11-30  Ryan Haddad  <ryanhaddad@apple.com>
2250
2251         Unreviewed build fix, removed unused lambda captures.
2252
2253         * workers/service/context/ServiceWorkerThread.cpp:
2254         (WebCore::ServiceWorkerThread::postFetchTask):
2255         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2256
2257 2017-11-30  Chris Dumez  <cdumez@apple.com>
2258
2259         Move SWClientConnection class out of server/ folder
2260         https://bugs.webkit.org/show_bug.cgi?id=180217
2261
2262         Reviewed by Brady Eidson.
2263
2264         Move SWClientConnection class out of server/ folder since the client connection
2265         lives in the WebProcess, not the Storage process.
2266
2267         * Sources.txt:
2268         * WebCore.xcodeproj/project.pbxproj:
2269         * workers/service/SWClientConnection.cpp: Renamed from Source/WebCore/workers/service/server/SWClientConnection.cpp.
2270         (WebCore::SWClientConnection::scheduleJob):
2271         (WebCore::SWClientConnection::finishedFetchingScript):
2272         (WebCore::SWClientConnection::failedFetchingScript):
2273         (WebCore::SWClientConnection::jobRejectedInServer):
2274         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2275         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2276         (WebCore::SWClientConnection::startScriptFetchForServer):
2277         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
2278         (WebCore::SWClientConnection::forEachContainer):
2279         (WebCore::SWClientConnection::updateRegistrationState):
2280         (WebCore::SWClientConnection::updateWorkerState):
2281         (WebCore::SWClientConnection::fireUpdateFoundEvent):
2282         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
2283         * workers/service/SWClientConnection.h: Renamed from Source/WebCore/workers/service/server/SWClientConnection.h.
2284         * workers/service/ServiceWorkerContainer.cpp:
2285
2286 2017-11-30  Chris Dumez  <cdumez@apple.com>
2287
2288         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread
2289         https://bugs.webkit.org/show_bug.cgi?id=180216
2290
2291         Reviewed by Brady Eidson.
2292
2293         ServiceWorkerThread's m_extendedEvents gets destroyed on the wrong thread. Those events live on the worker
2294         thread so we should destroy them on the worker thread, not the main thread. To address the issue, m_extendedEvents
2295         was moved to ServiceWorkerGlobalScope, which actually lives on the right thread.
2296
2297         * workers/service/ServiceWorkerGlobalScope.cpp:
2298         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
2299         * workers/service/ServiceWorkerGlobalScope.h:
2300         * workers/service/context/ServiceWorkerThread.cpp:
2301         (WebCore::ServiceWorkerThread::postFetchTask):
2302         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2303         (WebCore::ServiceWorkerThread::updateExtendedEventsSet): Deleted.
2304         * workers/service/context/ServiceWorkerThread.h:
2305         (WebCore::ServiceWorkerThread::hasPendingEvents const): Deleted.
2306
2307 2017-11-30  Chris Dumez  <cdumez@apple.com>
2308
2309         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted
2310         https://bugs.webkit.org/show_bug.cgi?id=180214
2311
2312         Reviewed by Brady Eidson.
2313
2314         SWServerToContextConnection / SWServerWorker do not need to be ThreadSafeRefCounted.
2315         RefCounted is sufficient as there is no longer any multithreading on server side.
2316
2317         * workers/service/server/SWServerToContextConnection.h:
2318         * workers/service/server/SWServerWorker.h:
2319
2320 2017-11-30  Chris Dumez  <cdumez@apple.com>
2321
2322         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise
2323         https://bugs.webkit.org/show_bug.cgi?id=180204
2324
2325         Reviewed by Brady Eidson.
2326
2327         ServiceWorkerGlobalScope::skipWaiting() should resolve its promise, even if it is not
2328         implemented yet. For now, always reject the promise.
2329
2330         * workers/service/ServiceWorkerGlobalScope.cpp:
2331         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
2332
2333 2017-11-30  Chris Dumez  <cdumez@apple.com>
2334
2335         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED
2336         https://bugs.webkit.org/show_bug.cgi?id=180212
2337
2338         Reviewed by Geoffrey Garen.
2339
2340         Mark a few heap-allocated service worker types as WTF_MAKE_FAST_ALLOCATED for performance.
2341
2342         * workers/service/server/SWOriginStore.h:
2343         * workers/service/server/SWServer.h:
2344         * workers/service/server/SWServerJobQueue.h:
2345         * workers/service/server/SWServerRegistration.h:
2346
2347 2017-11-30  Brady Eidson  <beidson@apple.com>
2348
2349         Make WorkerThread lifetime much more predictable.
2350         https://bugs.webkit.org/show_bug.cgi?id=180203
2351
2352         Reviewed by Chris Dumez.
2353
2354         No new tests (Fixes flakiness in existing and future tests).
2355
2356         The family of classes related to Workers has a complicated ownership model.
2357
2358         For Dedicated Workers, the WorkerThread object is owned by the WorkerMessagingProxy,
2359         which manages its own lifetime. Additionally, other object(s) have raw C++ references
2360         to it, and the expected lifetimes are described in comments scattered through a few files.
2361
2362         What it boils down to is that the "Worker" DOM object - which lives on the main thread - 
2363         is the key to the proper destruction of all of these objects.
2364
2365         For ServiceWorkers running in their own context process, there is no "Worker" on the main thread.
2366
2367         As a result, ServiceWorkers can get into a situation where their WorkerThread can be destroyed before
2368         their ServiceWorkerGlobalScope is destroyed on the running background thread.
2369
2370         There's no reason to not have WorkerThread guarantee its own lifetime until its background thread
2371         has actually completed.
2372
2373         * workers/WorkerThread.cpp:
2374         (WebCore::WorkerThread::workerThread): Protect the WorkerThread object during the entire runtime
2375           of the background thread itself, and release that protection on the main thread.
2376         * workers/WorkerThread.h:
2377
2378 2017-11-30  Chris Dumez  <cdumez@apple.com>
2379
2380         Populate self.registration.installing/waiting/active inside service workers
2381         https://bugs.webkit.org/show_bug.cgi?id=180168
2382
2383         Reviewed by Brady Eidson.
2384
2385         Populate self.registration.installing/waiting/active inside service workers.
2386         Also make sure the ServiceWorker's state properly gets updated inside
2387         service workers.
2388
2389         No new tests, extended existing test for self.registration.
2390
2391         * workers/service/ServiceWorker.cpp:
2392         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
2393         * workers/service/context/SWContextManager.cpp:
2394         (WebCore::SWContextManager::forEachServiceWorkerThread):
2395         * workers/service/context/SWContextManager.h:
2396         * workers/service/context/ServiceWorkerThread.cpp:
2397         (WebCore::ServiceWorkerThread::fireInstallEvent):
2398         (WebCore::ServiceWorkerThread::fireActivateEvent):
2399         * workers/service/server/SWClientConnection.cpp:
2400         (WebCore::SWClientConnection::updateRegistrationState):
2401         (WebCore::SWClientConnection::updateWorkerState):
2402         (WebCore::SWClientConnection::fireUpdateFoundEvent):
2403         * workers/service/server/SWClientConnection.h:
2404
2405 2017-11-30  Chris Dumez  <cdumez@apple.com>
2406
2407         Rename RegistrationOptions to ServiceWorkerRegistrationOptions
2408         https://bugs.webkit.org/show_bug.cgi?id=180207
2409
2410         Reviewed by Geoffrey Garen.
2411
2412         Rename RegistrationOptions to ServiceWorkerRegistrationOptions as the name
2413         RegistrationOptions is too generic and likely to conflict. Also modernize
2414         ServiceWorkerRegistrationOptions' IPC decoder.
2415
2416         * workers/service/ServiceWorkerContainer.h:
2417         * workers/service/ServiceWorkerJobData.h:
2418         (WebCore::ServiceWorkerJobData::decode):
2419         * workers/service/ServiceWorkerRegistrationOptions.cpp:
2420         (WebCore::ServiceWorkerRegistrationOptions::isolatedCopy const):
2421         * workers/service/ServiceWorkerRegistrationOptions.h:
2422         (WebCore::ServiceWorkerRegistrationOptions::encode const):
2423         (WebCore::ServiceWorkerRegistrationOptions::decode):
2424
2425 2017-11-30  Darin Adler  <darin@apple.com>
2426
2427         [Mac] remove unneeded RetainPtr use introduced in r225142
2428         https://bugs.webkit.org/show_bug.cgi?id=180202
2429
2430         Reviewed by Tim Horton.
2431
2432         * editing/mac/DictionaryLookup.h: Changed out arguments back to NSDictionary ** instead
2433         of RetainPtr because these use autorelease.
2434
2435         * editing/mac/DictionaryLookup.mm:
2436         (WebCore::tokenRange): Use NSDictionary **.
2437         (WebCore::DictionaryLookup::rangeForSelection): Ditto.
2438         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
2439         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
2440
2441 2017-11-30  Chris Dumez  <cdumez@apple.com>
2442
2443         Mark ServiceWorkerGlobalScope as final
2444         https://bugs.webkit.org/show_bug.cgi?id=180201
2445
2446         Reviewed by Alex Christensen.
2447
2448         * workers/service/ServiceWorkerGlobalScope.h:
2449
2450 2017-11-30  Zan Dobersek  <zdobersek@igalia.com>
2451
2452         [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
2453         https://bugs.webkit.org/show_bug.cgi?id=180141
2454
2455         Reviewed by Carlos Garcia Campos.
2456
2457         Introduce a painting engine concept that's used to perform painting
2458         for a given GraphicsLayer object.
2459
2460         The Nicosia::PaintingEngine object is leveraged in the
2461         CoordinatedGraphicsLayer::updateContentBuffers() method. It's retrieved
2462         through the CoordinatedGraphicsLayerClient interface, with a new method
2463         introduced there for this purpose.
2464
2465         The Nicosia::PaintingEngine interface is kept simple for now, with only
2466         a single paint() method. The only current implementation is the
2467         PaintingEngineBasic class, which simply reuses the code that was
2468         previously in CoordinatedGraphicsLayer::updateContentBuffers(),
2469         maintaining the current functionality.
2470
2471         The Nicosia::PaintingEngine::create() function returns a new
2472         PaintingEngine object. For now it defaults to PaintingEngineBasic, but
2473         it could be configured at configure-time or even runtime in the future
2474         to return a more advanced engine implementation.
2475
2476         No new tests -- no change in behavior.
2477
2478         * platform/TextureMapper.cmake:
2479         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: Added.
2480         (Nicosia::PaintingEngine::create):
2481         * platform/graphics/nicosia/NicosiaPaintingEngine.h: Added.
2482         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: Added.
2483         (Nicosia::PaintingEngineBasic::paint):
2484         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.h: Added.
2485         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2486         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
2487         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2488
2489 2017-11-30  Adrian Perez de Castro  <aperez@igalia.com>
2490
2491         [GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
2492         https://bugs.webkit.org/show_bug.cgi?id=179373
2493
2494         Reviewed by Xabier Rodriguez-Calvar.
2495
2496         This allows to build with WebAudio enabled even if video support is
2497         disabled by guarding usage of HTMLMediaElement with ENABLE(VIDEO).
2498
2499         No new tests needed.
2500
2501         * page/DeprecatedGlobalSettings.cpp:
2502         (WebCore::DeprecatedGlobalSettings::setGStreamerEnabled): Guard usage of HTMLMediaElement.
2503
2504 2017-11-29  Chris Dumez  <cdumez@apple.com>
2505
2506         ServiceWorker WebProcess sometimes crashes in JSVMClientData::~JSVMClientData()
2507         https://bugs.webkit.org/show_bug.cgi?id=180173
2508
2509         Reviewed by Alex Christensen.
2510
2511         The leak was caused by EventListeners remaining when destroying the VM, because
2512         JSEventListener refs the DOMWrapperWorld. To address the issue, we now call
2513         removeAllEventListeners() in the stop() method of ServiceWorkerContainer,
2514         ServiceWorkerRegistration and ServiceWorker. Those event listeners are no
2515         longer needed after ActiveDOMObject::stop() is called since the script
2516         execution context is about to be destroyed.
2517
2518         This is the same pattern used in IDBDatabase::stop(), IDBRequest::stop().
2519
2520         No new tests, already covered by existing test.
2521
2522         * workers/service/ServiceWorker.cpp:
2523         (WebCore::ServiceWorker::stop):
2524         * workers/service/ServiceWorkerContainer.cpp:
2525         (WebCore::ServiceWorkerContainer::stop):
2526         * workers/service/ServiceWorkerContainer.h:
2527         * workers/service/ServiceWorkerRegistration.cpp:
2528         (WebCore::ServiceWorkerRegistration::stop):
2529
2530 2017-11-29  Filip Pizlo  <fpizlo@apple.com>
2531
2532         GC should support isoheaps
2533         https://bugs.webkit.org/show_bug.cgi?id=179288
2534
2535         Reviewed by Saam Barati.
2536
2537         No new tests because no new behavior.
2538         
2539         Adopting changes in JSC Subspace API.
2540
2541         * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Added.
2542         * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Added.
2543         * bindings/js/JSDOMWrapper.cpp:
2544         (WebCore::outputConstraintSubspaceFor):
2545         (WebCore::globalObjectOutputConstraintSubspaceFor):
2546         * bindings/js/JSDOMWrapper.h:
2547         * bindings/js/WebCoreJSClientData.cpp:
2548         (WebCore::JSVMClientData::JSVMClientData):
2549         * bindings/js/WebCoreJSClientData.h:
2550         (WebCore::JSVMClientData::outputConstraintSpace):
2551         (WebCore::JSVMClientData::globalObjectOutputConstraintSpace):
2552         * bindings/scripts/CodeGeneratorJS.pm:
2553         (GenerateHeader):
2554
2555 2017-11-29  Eric Carlson  <eric.carlson@apple.com>
2556
2557         [MediaStream] Clean up audio and video capture factories
2558         https://bugs.webkit.org/show_bug.cgi?id=180156
2559         <rdar://problem/35753435>
2560
2561         Reviewed by Youenn Fablet.
2562
2563         No new tests, no behavior change.
2564
2565         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2566         (WebCore::RealtimeMediaSourceCenter::setAudioFactory): Deleted.
2567         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory): Deleted.
2568         (WebCore::RealtimeMediaSourceCenter::audioFactory): Deleted.
2569         (WebCore::RealtimeMediaSourceCenter::setVideoFactory): Deleted.
2570         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory): Deleted.
2571         (WebCore::RealtimeMediaSourceCenter::videoFactory): Deleted.
2572         (WebCore::RealtimeMediaSourceCenter::setAudioCaptureDeviceManager): Deleted.
2573         (WebCore::RealtimeMediaSourceCenter::unsetAudioCaptureDeviceManager): Deleted.
2574         (WebCore::RealtimeMediaSourceCenter::audioCaptureDeviceManager): Deleted.
2575         (WebCore::RealtimeMediaSourceCenter::setVideoCaptureDeviceManager): Deleted.
2576         (WebCore::RealtimeMediaSourceCenter::unsetVideoCaptureDeviceManager): Deleted.
2577         (WebCore::RealtimeMediaSourceCenter::videoCaptureDeviceManager): Deleted.
2578         * platform/mediastream/RealtimeMediaSourceCenter.h:
2579         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2580         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2581         * platform/mediastream/RealtimeMediaSourceSettings.cpp:
2582         (WebCore::RealtimeMediaSourceSettings::facingMode):
2583         (WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):
2584         (WebCore::userFacing): Deleted.
2585         (WebCore::environmentFacing): Deleted.
2586         (WebCore::leftFacing): Deleted.
2587         (WebCore::rightFacing): Deleted.
2588         * platform/mediastream/RealtimeMediaSourceSettings.h:
2589         (WebCore::RealtimeMediaSourceSettings::RealtimeMediaSourceSettings): Deleted.
2590         * platform/mediastream/mac/AVVideoCaptureSource.h:
2591         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2592         (WebCore::AVVideoCaptureSource::create):
2593         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2594         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2595         (): Deleted.
2596         (WebCore::AVVideoCaptureSourceFactory::setVideoCapturePageState): Deleted.
2597         (WebCore::avVideoCaptureSourceFactory): Deleted.
2598         (WebCore::AVVideoCaptureSource::factory): Deleted.
2599         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2600         (WebCore::videoCaptureSourceFactory):
2601         (WebCore::RealtimeMediaSourceCenterMac::audioFactory):
2602         (WebCore::RealtimeMediaSourceCenterMac::videoFactory):
2603         (WebCore::RealtimeMediaSourceCenterMac::audioCaptureDeviceManager):
2604         (WebCore::RealtimeMediaSourceCenterMac::videoCaptureDeviceManager):
2605         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac): Deleted.
2606         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory): Deleted.
2607         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory): Deleted.
2608         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioCaptureDeviceManager): Deleted.
2609         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoCaptureDeviceManager): Deleted.
2610         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2611         * platform/mock/MockRealtimeAudioSource.cpp:
2612         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2613         (WebCore::MockRealtimeAudioSource::startProducingData):
2614         * platform/mock/MockRealtimeMediaSourceCenter.h:
2615         * platform/mock/MockRealtimeVideoSource.cpp:
2616         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource):
2617         (WebCore::MockRealtimeVideoSource::startProducingData):
2618         * platform/mock/MockRealtimeVideoSource.h:
2619
2620 2017-11-29  Wenson Hsieh  <wenson_hsieh@apple.com>
2621
2622         [Attachment Support] Implement SPI for clients to make an attachment element display in-place
2623         https://bugs.webkit.org/show_bug.cgi?id=180153
2624         <rdar://problem/35735252>
2625
2626         Reviewed by Tim Horton.
2627
2628         Adds SPI support for inserting attachments using in-place display style, and updating display options for
2629         existing attachments. See comments below for more detail.
2630
2631         Tests: WKAttachmentTests.InPlaceImageAttachmentToggleDisplayMode
2632                WKAttachmentTests.InPlaceImageAttachmentParagraphInsertion
2633                WKAttachmentTests.InPlaceVideoAttachmentInsertionWithinList
2634                WKAttachmentTests.InPlacePDFAttachmentCutAndPaste
2635
2636         * WebCore.xcodeproj/project.pbxproj:
2637         * editing/Editor.cpp:
2638         (WebCore::Editor::insertAttachment):
2639         (WebCore::Editor::insertAttachmentFromFile):
2640
2641         Update display options for the attachment before inserting into the document.
2642
2643         * editing/Editor.h:
2644         * html/AttachmentTypes.h: Added.
2645
2646         Add a new header to define the new attachment display types. This lets us avoid importing HTMLAttachmentElement.h
2647         and instead just import AttachmentTypes.h in some places in WebKit that only deal with plumbing
2648         AttachmentDisplayOptions to the web process.
2649
2650         (WebCore::AttachmentDisplayOptions::encode const):
2651         (WebCore::AttachmentDisplayOptions::decode):
2652
2653         Support serializing and deserializing attachment display options.
2654
2655         * html/HTMLAttachmentElement.cpp:
2656         (WebCore::HTMLAttachmentElement::setFile):
2657
2658         Regenerate the shadow root if needed when setting the file.
2659
2660         (WebCore::HTMLAttachmentElement::updateDisplayMode):
2661
2662         Introduce a new method to update the display mode of an attachment element. This builds up the shadow root of
2663         the attachment if it is displayed in-place.
2664
2665         (WebCore::HTMLAttachmentElement::ensureInnerImage):
2666         (WebCore::HTMLAttachmentElement::ensureInnerVideo):
2667
2668         Helpers to insert image and video elements into the shadow root if needed, and return the image or video element.
2669
2670         (WebCore::HTMLAttachmentElement::innerImage const):
2671         (WebCore::HTMLAttachmentElement::innerVideo const):
2672
2673         Helpers to retrieve existing image and video elements in the shadow root.
2674
2675         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2676
2677         Appends and configures the attachment element's shadow root for inline display, initializing an image or video
2678         element or neither, depending on the attachment type.
2679
2680         * html/HTMLAttachmentElement.h:
2681
2682         Introduce an AttachmentDisplayOptions struct which mirrors _WKAttachmentDisplayOptions in the WebKit layer. For
2683         now, this only contains a display mode enum.
2684
2685         * platform/audio/ios/AudioSessionIOS.mm:
2686
2687         Avoid this AVAudioSession assertion when targeting iOS simulator. AVAudioSession always throws this error when
2688         setting an audio session category in the simulator, even in a basic test app, since AVFoundation doesn't support
2689         audio sessions in the simulator.
2690
2691         (WebCore::AudioSession::setCategory):
2692
2693 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2694
2695         Missing layer content when animating elements on-screen
2696         https://bugs.webkit.org/show_bug.cgi?id=180178
2697         rdar://problem/34923438
2698
2699         Reviewed by Dean Jackson.
2700
2701         If a delayed animation starts, that animates layers from offscreen, then we would fail
2702         to run the logic that ensures that those layers have backing store.
2703
2704         Fix by ensuring that if any layer starts or ends a transform animation, we re-evaluate
2705         backing store attachment on all its descendants.
2706
2707         I tried to make a test, but layer flushing is timing-sensitive and the test would have taken
2708         5s, and not been reliable. There's a manual test in the bug.
2709
2710         * platform/graphics/ca/GraphicsLayerCA.cpp:
2711         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2712         * platform/graphics/ca/GraphicsLayerCA.h:
2713
2714 2017-11-29  Youenn Fablet  <youenn@apple.com>
2715
2716         ServiceWorkerClient objects should be reused if there is already one existing with the same identifier
2717         https://bugs.webkit.org/show_bug.cgi?id=180143
2718
2719         Reviewed by Chris Dumez.
2720
2721         Covered by updated tests.
2722
2723         ServiceWorkerGlobalScope keeps a map of all live ServiceWorkerClient objects.
2724         Before creating a new client, it checks whether the map has one such object with the same identifier.
2725         If so, it reuses this object. Otherwise it creates either a ServiceWorkerWindowClient or ServiceWorkerClient.
2726
2727         Add support for using a ServiceWorkerClientIdentifier as a HashMap key.
2728
2729         * workers/service/ServiceWorkerClient.cpp:
2730         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2731         (WebCore::ServiceWorkerClient::~ServiceWorkerClient):
2732         * workers/service/ServiceWorkerClient.h:
2733         (WebCore::ServiceWorkerClient::getOrCreate):
2734         * workers/service/ServiceWorkerClientIdentifier.h:
2735         (WebCore::ServiceWorkerClientIdentifier::hash const):
2736         (WTF::ServiceWorkerClientIdentifierHash::hash):
2737         (WTF::ServiceWorkerClientIdentifierHash::equal):
2738         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::emptyValue):
2739         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::constructDeletedValue):
2740         (WTF::HashTraits<WebCore::ServiceWorkerClientIdentifier>::isDeletedValue):
2741         * workers/service/ServiceWorkerGlobalScope.cpp:
2742         (WebCore::ServiceWorkerGlobalScope::serviceWorkerClient):
2743         (WebCore::ServiceWorkerGlobalScope::addServiceWorkerClient):
2744         (WebCore::ServiceWorkerGlobalScope::removeServiceWorkerClient):
2745         * workers/service/ServiceWorkerGlobalScope.h:
2746         * workers/service/ServiceWorkerWindowClient.cpp:
2747         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2748         * workers/service/ServiceWorkerWindowClient.h:
2749         * workers/service/context/ServiceWorkerThread.cpp:
2750         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2751
2752 2017-11-29  Zalan Bujtas  <zalan@apple.com>
2753
2754         Add missing WTF_MAKE_ISO_ALLOCATED macros
2755         https://bugs.webkit.org/show_bug.cgi?id=180165
2756         <rdar://problem/35755617>
2757
2758         Reviewed by Simon Fraser.
2759
2760         * rendering/RenderFrame.h:
2761         * rendering/RenderFullScreen.cpp:
2762         * rendering/RenderIFrame.h:
2763
2764 2017-11-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
2765
2766         Remove the ImageSource from the class hierarchy that connects BitmapImage to ImageFrame
2767         https://bugs.webkit.org/show_bug.cgi?id=175595
2768
2769         Reviewed by Darin Adler.
2770
2771         The class hierarchy that connects BitmapImage to ImageFrame has been
2772         troublesome. ImageSource does not have a clear responsibility other than
2773         a bridge that connects BitmapIamge to ImageFrameCache. Sharing the 
2774         ImageDecoder between ImageSource and ImageFrameCache is ugly and caused
2775         few crashes in the past.
2776
2777         This patch will do the first step for fixing this issue. First get rid of
2778         ImageSource by moving its APIs to ImageFrameCache and BitmapImage. Replace
2779         all the instances of ImageSource by ImageFrameCache. The next step will
2780         be to rename ImageFrameCache to ImageSource. But this will be done in a
2781         follow-up patch
2782
2783         * Sources.txt:
2784         * WebCore.xcodeproj/project.pbxproj:
2785         * platform/graphics/BitmapImage.cpp:
2786         (WebCore::BitmapImage::BitmapImage):
2787         (WebCore::BitmapImage::~BitmapImage):
2788         (WebCore::BitmapImage::destroyDecodedData):
2789         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
2790         (WebCore::BitmapImage::dataChanged):
2791         (WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded):
2792         (WebCore::BitmapImage::draw):
2793         (WebCore::BitmapImage::canUseAsyncDecodingForLargeImages const):
2794         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const):
2795         (WebCore::BitmapImage::subsamplingLevelForScaleFactor):
2796         (WebCore::BitmapImage::canDestroyDecodedData):
2797         (WebCore::BitmapImage::internalStartAnimation):
2798         (WebCore::BitmapImage::stopAnimation):
2799         (WebCore::BitmapImage::decode):
2800         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2801         (WebCore::BitmapImage::dump const):
2802         * platform/graphics/BitmapImage.h:
2803         * platform/graphics/GraphicsContext3D.h:
2804         * platform/graphics/ImageFrameCache.cpp:
2805         (WebCore::ImageFrameCache::ImageFrameCache):
2806         (WebCore::ImageFrameCache::ensureDecoderAvailable):
2807         (WebCore::ImageFrameCache::setData):
2808         (WebCore::ImageFrameCache::resetData):
2809         (WebCore::ImageFrameCache::dataChanged):
2810         (WebCore::ImageFrameCache::isAllDataReceived):
2811         (WebCore::ImageFrameCache::clearFrameBufferCache):
2812         (WebCore::ImageFrameCache::canUseAsyncDecoding):
2813         (WebCore::ImageFrameCache::maximumSubsamplingLevel):
2814         (WebCore::ImageFrameCache::setTargetContext):
2815         (WebCore::ImageFrameCache::createFrameImageAtIndex):
2816         (WebCore::ImageFrameCache::dump):
2817         (WebCore::ImageFrameCache::setDecoder): Deleted.
2818         (WebCore::ImageFrameCache::decoder const): Deleted.
2819         * platform/graphics/ImageFrameCache.h:
2820         (WebCore::ImageFrameCache::create):
2821         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
2822         * platform/graphics/ImageSource.cpp: Removed.
2823         * platform/graphics/ImageSource.h: Removed.
2824         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2825         (WebCore::GraphicsContext3D::ImageExtractor::~ImageExtractor):
2826         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2827         * platform/graphics/cg/GraphicsContext3DCG.cpp:
2828         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2829         * platform/graphics/cg/ImageSourceCG.h:
2830
2831 2017-11-29  Brady Eidson  <beidson@apple.com>
2832
2833         When managing context startups, make ServiceWorkerJobDataIdentifier's optional.
2834         https://bugs.webkit.org/show_bug.cgi?id=180166
2835
2836         Reviewed by Chris Dumez.
2837
2838         No new tests (No behavior change).
2839
2840         We'll sometimes be starting SW contexts without an associated job, so ServiceWorkerContextData
2841         should not required actually having a job identifier.
2842
2843         * workers/service/ServiceWorkerContextData.h:
2844         (WebCore::ServiceWorkerContextData::decode):
2845
2846         * workers/service/context/SWContextManager.h:
2847
2848         * workers/service/server/SWServer.cpp:
2849         (WebCore::SWServer::scriptContextFailedToStart):
2850         (WebCore::SWServer::scriptContextStarted):
2851         (WebCore::SWServer::didFinishInstall):
2852         * workers/service/server/SWServer.h:
2853
2854         * workers/service/server/SWServerToContextConnection.cpp:
2855         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
2856         (WebCore::SWServerToContextConnection::scriptContextStarted):
2857         (WebCore::SWServerToContextConnection::didFinishInstall):
2858         * workers/service/server/SWServerToContextConnection.h:
2859
2860         * workers/service/server/SWServerWorker.cpp:
2861         (WebCore::SWServerWorker::scriptContextFailedToStart):
2862         (WebCore::SWServerWorker::scriptContextStarted):
2863         (WebCore::SWServerWorker::didFinishInstall):
2864         * workers/service/server/SWServerWorker.h:
2865
2866 2017-11-29  Youenn Fablet  <youenn@apple.com>
2867
2868         Add support for service worker generated redirections
2869         https://bugs.webkit.org/show_bug.cgi?id=179498
2870
2871         Reviewed by Darin Adler.
2872
2873         Test: http/tests/workers/service/service-worker-redirection-fetch.https.html
2874
2875         Added redirection routines following fetch specification to:
2876         - check whether a response is a redirection
2877         - generate a redirected request from a request and its redirection response.
2878         Added some specific redirect request generation following existing WebKit networking code.
2879
2880         * Modules/fetch/FetchResponse.cpp:
2881         (WebCore::FetchResponse::redirect):
2882         (WebCore::isRedirectStatus): Deleted.
2883         * platform/network/ResourceRequestBase.cpp:
2884         (WebCore::shouldUseGet):
2885         (WebCore::ResourceRequestBase::redirectedRequest const):
2886         * platform/network/ResourceRequestBase.h:
2887         * platform/network/ResourceResponseBase.h:
2888         (WebCore::ResourceResponseBase::isRedirectionStatusCode):
2889         (WebCore::ResourceResponseBase::isRedirection const):
2890
2891 2017-11-29  Chris Dumez  <cdumez@apple.com>
2892
2893         Start exposing self.registration inside service workers
2894         https://bugs.webkit.org/show_bug.cgi?id=180162
2895
2896         Reviewed by Brady Eidson.
2897
2898         Start exposing self.registration inside service workers as per:
2899         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
2900
2901         This is very initial support:
2902         - The operations on the registration (such as update) will reject the promise for now.
2903         - The registration's service workers are not yet populated.
2904
2905         This will be implemented in a follow-up.
2906
2907         Tests: http/tests/workers/service/ServiceWorkerGlobalScope_registration_SameObject.html
2908                http/tests/workers/service/self_registration.html
2909
2910         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp:
2911         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
2912         * workers/service/ServiceWorkerContainer.cpp:
2913         (WebCore::ServiceWorkerContainer::addRegistration):
2914         * workers/service/ServiceWorkerContextData.cpp:
2915         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2916         * workers/service/ServiceWorkerContextData.h:
2917         (WebCore::ServiceWorkerContextData::encode const):
2918         (WebCore::ServiceWorkerContextData::decode):
2919         * workers/service/ServiceWorkerGlobalScope.cpp:
2920         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
2921         * workers/service/ServiceWorkerGlobalScope.h:
2922         (WebCore::ServiceWorkerGlobalScope::registration):
2923         * workers/service/server/SWServer.cpp:
2924         (WebCore::SWServer::updateWorker):
2925         (WebCore::SWServer::installContextData):
2926         * workers/service/server/SWServer.h:
2927         * workers/service/server/SWServerJobQueue.cpp:
2928         (WebCore::SWServerJobQueue::scriptFetchFinished):
2929
2930 2017-11-29  Youenn Fablet  <youenn@apple.com>
2931
2932         Add support for FetchEvent.clientId
2933         https://bugs.webkit.org/show_bug.cgi?id=180052
2934
2935         Reviewed by Chris Dumez.
2936
2937         Covered by updated test.
2938
2939         Add script execution context identifier as a FetchOptions parameter.
2940         This is then sent to the service worker process which can then set FetchEvent.clientId appropriately.
2941         If the fetch is for a subresource, clientId is used directly.
2942         If it is a navigation, clientId is set to targetClientId.
2943
2944         * loader/FetchOptions.h:
2945         (WebCore::FetchOptions::encode const):
2946         (WebCore::FetchOptions::decode):
2947         * loader/cache/CachedResourceLoader.cpp:
2948         (WebCore::CachedResourceLoader::prepareFetch):
2949         * loader/cache/CachedResourceRequest.cpp:
2950         (WebCore::CachedResourceRequest::setClientIdentifierIfNeeded):
2951         * loader/cache/CachedResourceRequest.h:
2952         * workers/service/context/ServiceWorkerFetch.cpp:
2953         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2954         * workers/service/context/ServiceWorkerFetch.h:
2955         * workers/service/context/ServiceWorkerThread.cpp:
2956         (WebCore::ServiceWorkerThread::postFetchTask):
2957         * workers/service/context/ServiceWorkerThread.h:
2958
2959 2017-11-29  Youenn Fablet  <youenn@apple.com>
2960
2961         Flaky crash in WebCore::DOMGuardedObject::clear() during service worker tests
2962         https://bugs.webkit.org/show_bug.cgi?id=180045
2963         <rdar://problem/35737288>
2964
2965         Reviewed by Chris Dumez.
2966
2967         Manually tested by running concurrently service worker tests using FetchEvents which store promise references.
2968
2969         Before the patch, on workers, clearing of DOMGuardedObjects happens at the time WorkerGlobalScope is destroyed.
2970         This is too late as it is expected that the JSDOMGlobalObject is still alive.
2971
2972         This patch adds a clearDOMGuardedObjects method on JSWorkerGlobalScopeBase.
2973         It is called when stopping a WorkerThread, just before releasing the strong reference to JSWorkerGlobalScopeBase.
2974
2975         * bindings/js/JSDOMGuardedObject.h:
2976         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2977         (WebCore::JSWorkerGlobalScopeBase::clearDOMGuardedObjects):
2978         * bindings/js/JSWorkerGlobalScopeBase.h:
2979         * bindings/js/WorkerScriptController.cpp:
2980
2981 2017-11-29  Alex Christensen  <achristensen@webkit.org>
2982
2983         Fix Mac CMake build.
2984
2985         * PlatformMac.cmake:
2986
2987 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
2988
2989         REGRESSION (r213590): Scrolling to anchors broken in web views when content loaded via HTML string
2990         https://bugs.webkit.org/show_bug.cgi?id=180155
2991         rdar://problem/34220827
2992
2993         Reviewed by Zalan Bujtas.
2994         
2995         When content is loaded in a UIWebView or WKWebView via an HTML string, history().currentItem()
2996         is null so itemAllowsScrollRestoration() would return false, preventing scrolling to anchors.
2997
2998         Fix by allowing scroll restoration if the the history item is null.
2999
3000         Tested by WebKit.NoHistoryItemScrollToFragment API test.
3001
3002         * loader/FrameLoader.cpp:
3003         (WebCore::itemAllowsScrollRestoration):
3004
3005 2017-11-29  Chris Dumez  <cdumez@apple.com>
3006
3007         Introduce ServiceWorkerContainer::ensureSWClientConnection()
3008         https://bugs.webkit.org/show_bug.cgi?id=180146
3009
3010         Reviewed by Youenn Fablet.
3011
3012         Introduce ServiceWorkerContainer::ensureSWClientConnection() to reduce
3013         code duplication. Also use callOnMainThread() in preparation for this
3014         getting called from a service worker thread (now that ServiceWorkerContainer
3015         is exposed to service workers). This is needed because constructing the
3016         SWClientConnection initializes the IPC connection from the WebProcess to
3017         the StorageProcess, which involves a synchronous IPC with the UIProcess.
3018         Doing a synchronous IPC from a background thread is unsupported.
3019
3020         * workers/service/ServiceWorkerContainer.cpp:
3021         (WebCore::ServiceWorkerContainer::addRegistration):
3022         (WebCore::ServiceWorkerContainer::getRegistration):
3023         (WebCore::ServiceWorkerContainer::getRegistrations):
3024         (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
3025         * workers/service/ServiceWorkerContainer.h:
3026
3027 2017-11-29  Antoine Quint  <graouts@apple.com>
3028
3029         [iOS] Media controls should stop updating while media is playing in fullscreen
3030         https://bugs.webkit.org/show_bug.cgi?id=180144
3031         <rdar://problem/35060379>
3032
3033         Reviewed by Eric Carlson.
3034
3035         Updating inline media controls while playing media in fullscreen is useless since we're guaranteed not to
3036         have those controls visible, and hurtful since this has impact on battery life. To avoid this, we remove
3037         all media event listeners while in fullscreen on iOS, which will prevent the UI to be udpated since all
3038         updates are driven by media events.
3039
3040         To implement this, we remove the MediaControllerSupport destroy() method and make it a disable() method,
3041         and factor code out of the MediaControllerSupport constructor into an enable() method that registers the
3042         media event listeners. Then, as we enter and exit fullscreen, we call the disable() and enable() method
3043         on the various MediaControllerSupport objects that were created to support the iOS inline media controls.
3044
3045         Test: media/modern-media-controls/media-controller/ios/media-controller-stop-updates-in-fullscreen.html
3046
3047         * Modules/modern-media-controls/media/controls-visibility-support.js:
3048         (ControlsVisibilitySupport):
3049         (ControlsVisibilitySupport.prototype.enable):
3050         (ControlsVisibilitySupport.prototype.disable):
3051         (ControlsVisibilitySupport.prototype.destroy): Deleted.
3052         * Modules/modern-media-controls/media/media-controller-support.js:
3053         (MediaControllerSupport):
3054         (MediaControllerSupport.prototype.enable):
3055         (MediaControllerSupport.prototype.disable):
3056         (MediaControllerSupport.prototype.destroy): Deleted.
3057         * Modules/modern-media-controls/media/media-controller.js:
3058         (MediaController.prototype.handleEvent):
3059         (MediaController.prototype._updateControlsIfNeeded):
3060         (MediaController.prototype._updateSupportingObjectsEnabledState):
3061         (MediaController):
3062
3063 2017-11-29  Simon Fraser  <simon.fraser@apple.com>
3064
3065         Viewport unit values affected by Comand-+ zoom
3066         https://bugs.webkit.org/show_bug.cgi?id=145614
3067
3068         Reviewed by Zalan Bujtas.
3069         
3070         Don't apply zooming when resolving viewport-relative lengths, since they should not
3071         change based on the zoom level.
3072
3073         Test: fast/css/viewport-units-zoom.html
3074
3075         * css/CSSPrimitiveValue.cpp:
3076         (WebCore::CSSPrimitiveValue::computeNonCalcLengthDouble):
3077
3078 2017-11-29  Brent Fulgham  <bfulgham@apple.com>
3079
3080         Unreviewed test fix after r225264.
3081         <rdar://problem/35750689>
3082
3083         The changes in r225264 were meant to have no changes in behavior. However, I mistakenly
3084         switched to a secure coding API call in the PlatformPasteboard::write method. This should
3085         have used the 'insecure' version of this function.
3086
3087         * platform/ios/PlatformPasteboardIOS.mm:
3088         (WebCore::PlatformPasteboard::write): 
3089
3090 2017-11-29  Youenn Fablet  <youenn@apple.com>
3091
3092         LibWebRTCPeerConnectionBackend should clean its stats promises when being cleaned
3093         https://bugs.webkit.org/show_bug.cgi?id=180101
3094
3095         Reviewed by Eric Carlson.
3096
3097         No change of behavior.
3098
3099         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3100         (WebCore::LibWebRTCPeerConnectionBackend::doStop): Cleaning stat promises hash map.
3101
3102 2017-11-29  Zan Dobersek  <zdobersek@igalia.com>
3103
3104         [CoordGraphics] Rename CoordinatedBuffer to Nicosia::Buffer
3105         https://bugs.webkit.org/show_bug.cgi?id=180135
3106
3107         Reviewed by Carlos Garcia Campos.
3108
3109         Rename CoordinatedBuffer to Nicosia::Buffer, starting an abstraction
3110         layer that will in the future allow us to prototype and potentially
3111         support different 2D rasterization libraries. The layer is envisioned
3112         as separate from the CoordinatedGraphics code, but will in the mid-term
3113         only be used there.
3114
3115         In order to keep CMake changes to a minimum for now, the source code is
3116         included in the build along with the CoordinatedGraphics source files,
3117         in TextureMapper.cmake.
3118
3119         No new tests -- no change in functionality.
3120
3121         * platform/TextureMapper.cmake:
3122         * platform/graphics/nicosia/NicosiaBuffer.cpp: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp.
3123         (Nicosia::Buffer::create):
3124         (Nicosia::Buffer::Buffer):
3125         (Nicosia::Buffer::context):
3126         (Nicosia::Buffer::uploadImage):
3127         * platform/graphics/nicosia/NicosiaBuffer.h: Renamed from Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h.
3128         (Nicosia::Buffer::size const):
3129         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3130         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
3131         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3132         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3133         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
3134         (WebCore::CoordinatedImageBacking::update):
3135         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
3136         * platform/graphics/texmap/coordinated/Tile.h:
3137
3138 2017-11-29  Antoine Quint  <graouts@apple.com>
3139
3140         Pressing the space bar while watching a fullscreen video doesn't play or pause
3141         https://bugs.webkit.org/show_bug.cgi?id=180033
3142         <rdar://problem/33610443>
3143
3144         Reviewed by Eric Carlson.
3145
3146         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3147         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3148         one of the media controls using the keyboard will not let the events we register for be dispatched
3149         this far along the event dispatch phase.
3150
3151         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3152
3153         * Modules/modern-media-controls/media/media-controller.js:
3154         (MediaController):
3155         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3156         lead to some extraneous unhandled promise console logging that pollutes test output.
3157         (MediaController.prototype.handleEvent):
3158
3159 2017-11-28  Brent Fulgham  <bfulgham@apple.com>
3160
3161         Adopt updated NSKeyed[Un]Archiver API when available
3162         https://bugs.webkit.org/show_bug.cgi?id=180127
3163         <rdar://problem/35710738>
3164
3165         Reviewed by Alex Christensen.
3166
3167         Switch to new NSKeyed[Un]Archiver methods when available. We do not attempt
3168         to adopt secure coding in places we were not under the original API.
3169
3170         Most of the new API is wrapped in a set of convenience methods so we can
3171         build without the new API on older systems.
3172
3173         No change in behavior.
3174
3175         * editing/cocoa/EditorCocoa.mm:
3176         (WebCore::archivedDataForAttributedString): Use new convenience method
3177         to archive the string object.
3178         * loader/archive/cf/LegacyWebArchiveMac.mm:
3179         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
3180         use secure coding where possible.
3181         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
3182         * platform/ios/PlatformPasteboardIOS.mm:
3183         (WebCore::PlatformPasteboard::write): Use new secure API.
3184         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
3185         * testing/cocoa/WebArchiveDumpSupport.mm:
3186         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
3187         secure coding API where possible.
3188
3189 2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
3190
3191         Web Inspector: Cleanup Inspector classes be more consistent about using fast malloc / noncopyable
3192         https://bugs.webkit.org/show_bug.cgi?id=180119
3193
3194         Reviewed by Devin Rousso.
3195
3196         * inspector/InspectorCanvas.cpp:
3197         * inspector/InspectorDatabaseResource.cpp:
3198         * inspector/InspectorFrontendClientLocal.cpp:
3199         * inspector/InspectorFrontendClientLocal.h:
3200         * inspector/InspectorFrontendHost.cpp:
3201         * inspector/InspectorHistory.h:
3202         * inspector/InspectorInstrumentation.cpp:
3203         * inspector/InspectorOverlay.cpp:
3204         * inspector/InspectorShaderProgram.cpp:
3205         * inspector/InspectorStyleSheet.cpp:
3206         * inspector/InstrumentingAgents.cpp:
3207         * inspector/PageScriptDebugServer.h:
3208         * inspector/TimelineRecordFactory.cpp:
3209         * inspector/WebInjectedScriptManager.cpp:
3210         * inspector/WebInjectedScriptManager.h:
3211         * inspector/WorkerScriptDebugServer.cpp:
3212         * inspector/WorkerScriptDebugServer.h:
3213         * inspector/agents/*
3214         Be more consistent about namespace / fast malloc / noncopyable.
3215
3216 2017-11-28  Zan Dobersek  <zdobersek@igalia.com>
3217
3218         [Cairo] Limit the number of active contexts in GraphicsContext3DCairo
3219         https://bugs.webkit.org/show_bug.cgi?id=166968
3220
3221         Reviewed by Alex Christensen.
3222
3223         Cairo's implementation of GraphicsContext3D should follow the Mac's
3224         and limit the number of active GraphicsContext3D objects.
3225
3226         The active contexts are listed in a global Deque, with the first
3227         among them being recycled when the GraphicsContext3D::create()
3228         function sees that the limit has been reached. That function still
3229         returns null if even after recycling the number of contexts didn't
3230         decrease.
3231
3232         Finally, in the GraphicsContext3D destructor, the context being
3233         destroyed is removed from the list of active contexts.
3234
3235         No new tests -- relevant tests are now passing.
3236
3237         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
3238         (WebCore::activeContexts):
3239         (WebCore::GraphicsContext3D::create):
3240         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3241
3242 2017-11-28  Zalan Bujtas  <zalan@apple.com>
3243
3244         Clean up spanners before creating nested column context
3245         https://bugs.webkit.org/show_bug.cgi?id=180107
3246         <rdar://problem/35686655>
3247         
3248         Reviewed by Antti Koivisto.
3249
3250         When an existing spanner placeholder is moved into a newly constructed (and nested)
3251         multicolumn context, we figure it's not valid anymore and end up destroying it
3252         (see RenderMultiColumnFlow::fragmentedFlowDescendantInserted).
3253         This is very unfortunate since as we climb back on the stack, we could hit this renderer as
3254         the newly inserted child. 
3255
3256         This patch proactively removes the invalid placeholders and moves the associated spanners back to their
3257         original position. 
3258
3259         Test: fast/multicol/crash-when-constructing-nested-columns.html
3260
3261         * rendering/RenderMultiColumnFlow.h:
3262         * style/RenderTreeUpdaterMultiColumn.cpp:
3263         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): 
3264         RenderTreeUpdater::MultiColumn::destroyFragmentedFlow still relies on the placeholder removal
3265         logic in RenderMultiColumnFlow::fragmentedFlowDescendantInserted.
3266
3267 2017-11-28  Tim Horton  <timothy_horton@apple.com>
3268
3269         REGRESSION (High Sierra): Layout Test fast/multicol/newmulticol/spanner2.html is a flaky image failure on WK1
3270         https://bugs.webkit.org/show_bug.cgi?id=177826
3271         <rdar://problem/34876498>
3272
3273         Reviewed by Alexey Proskuryakov.
3274
3275         No new tests, fixes some already-broken tests.
3276
3277         * platform/graphics/mac/PDFDocumentImageMac.mm:
3278         (WebCore::PDFDocumentImage::drawPDFPage):
3279         Save and restore one more piece of context state that
3280         PDFKit mutates while drawing.
3281
3282 2017-11-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3283
3284         Allow attachment elements with no appearance to defer rendering to child nodes
3285         https://bugs.webkit.org/show_bug.cgi?id=180117
3286         <rdar://problem/35735339>
3287
3288         Reviewed by Tim Horton.
3289
3290         Test: fast/attachment/attachment-without-appearance.html
3291
3292         When -webkit-appearance: none; is specified on an attachment element, allow it to fall back to rendering its
3293         subtree. Currently, attachment elements without an appearance don't allow this and truncate the render tree at
3294         the RenderAttachment, since RenderAttachment cannot have any children.
3295
3296         In a followup, this will enable us to render a shadow subtree under the attachment element to display in-place
3297         attachment content, and easily toggle between in-place and icon display by changing the appearance.
3298
3299         * html/HTMLAttachmentElement.cpp:
3300         (WebCore::HTMLAttachmentElement::createElementRenderer):
3301
3302         If no appearance is specified, emit a RenderBlockFlow instead of a RenderAttachment.
3303
3304         (WebCore::HTMLAttachmentElement::setFile):
3305         (WebCore::HTMLAttachmentElement::attachmentRenderer const):
3306
3307         Renamed from renderer(). HTMLAttachmentElement::renderer() now uses the superclass' implementation, and no
3308         longer returns a RenderAttachment in all circumstances. Instead, places that expect a RenderAttachment now go
3309         through HTMLAttachmentElement::renderAttachment() instead.
3310
3311         (WebCore::HTMLAttachmentElement::parseAttribute):
3312         * html/HTMLAttachmentElement.h:
3313         * page/DragController.cpp:
3314         (WebCore::DragController::startDrag):
3315         * rendering/RenderAttachment.h:
3316         (WebCore::HTMLAttachmentElement::renderer const): Deleted.
3317
3318 2017-11-28  Youenn Fablet  <youenn@apple.com>
3319
3320         Register Documents as ServiceWorker clients to the StorageProcess
3321         https://bugs.webkit.org/show_bug.cgi?id=180047
3322
3323         Reviewed by Brady Eidson.
3324
3325         No change of behavior.
3326         These changes will be covered when implementing ServiceWorker Clients API.
3327
3328         Registering a document when being created by DocumentLoader.
3329         In the future, we may restrict registration to only documents related to origins that have some ongoing service worker activity.
3330         This would require to keep track of which documents are registered so that we unregister these ones.
3331         This would also require to register existing documents when one of the document with the same origin starts registering a service worker.
3332         Unregistering a document inside prepareForDestruction.
3333
3334         Storing all clients in SWServer as a HasMap keyed by ClientOrigin.
3335         Processing will then iterate through the list of clients scoped by the client origin.
3336
3337         Adding a ClientOrigin class as a pair of top origin and frame origin since service workers will be related based on that information.
3338
3339         * WebCore.xcodeproj/project.pbxproj:
3340         * dom/Document.cpp:
3341         (WebCore::Document::prepareForDestruction):
3342         * loader/DocumentLoader.cpp:
3343         (WebCore::DocumentLoader::commitData):
3344         * page/ClientOrigin.h: Added.
3345         (WebCore::ClientOrigin::emptyKey):
3346         (WebCore::ClientOrigin::hash const):
3347         (WebCore::ClientOrigin::operator== const):
3348         (WTF::ClientOriginKeyHash::hash):
3349         (WTF::ClientOriginKeyHash::equal):
3350         (WTF::HashTraits<WebCore::ClientOrigin>::emptyValue):
3351         (WTF::HashTraits<WebCore::ClientOrigin>::constructDeletedValue):
3352         (WTF::HashTraits<WebCore::ClientOrigin>::isDeletedValue):
3353         * workers/service/ServiceWorkerClientIdentifier.h:
3354         (WebCore::ServiceWorkerClientIdentifier::operator== const):
3355         * workers/service/server/SWClientConnection.h:
3356         * workers/service/server/SWServer.cpp:
3357         (WebCore::SWServer::registerServiceWorkerClient):
3358         (WebCore::SWServer::unregisterServiceWorkerClient):
3359         * workers/service/server/SWServer.h:
3360
3361 2017-11-28  Chris Dumez  <cdumez@apple.com>
3362
3363         ServiceWorkerGlobalScope.clients should always return the same object
3364         https://bugs.webkit.org/show_bug.cgi?id=180116
3365
3366         Reviewed by Geoffrey Garen.
3367
3368         ServiceWorkerGlobalScope.clients should always return the same object, as per the specification:
3369         - https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-interface
3370
3371         Test: http/tests/workers/service/ServiceWorkerGlobalScope_clients_SameObject.html
3372
3373         * Sources.txt:
3374         * WebCore.xcodeproj/project.pbxproj:
3375         * bindings/js/JSServiceWorkerGlobalScopeCustom.cpp: Added.
3376         (WebCore::JSServiceWorkerGlobalScope::visitAdditionalChildren):
3377         * workers/service/ServiceWorkerClients.idl:
3378         * workers/service/ServiceWorkerGlobalScope.idl:
3379
3380 2017-11-28  Chris Dumez  <cdumez@apple.com>
3381
3382         Get rid of ServiceWorker::allWorkers() hashmap
3383         https://bugs.webkit.org/show_bug.cgi?id=180111
3384
3385         Reviewed by Brady Eidson.
3386
3387         Get rid of ServiceWorker::allWorkers() hashmap as it is not thread safe and we'll soon have
3388         ServiceWorker objects living in various service worker threads.
3389
3390         Instead, we now have a per-ScriptExecutionContext map, which is inherently thread-safe.
3391
3392         No new tests, no web-facing behavior change.
3393
3394         * dom/ScriptExecutionContext.cpp:
3395         (WebCore::ScriptExecutionContext::registerServiceWorker):
3396         (WebCore::ScriptExecutionContext::unregisterServiceWorker):
3397         * dom/ScriptExecutionContext.h:
3398         (WebCore::ScriptExecutionContext::serviceWorker):
3399         * workers/service/ServiceWorker.cpp:
3400         (WebCore::ServiceWorker::getOrCreate):
3401         (WebCore::ServiceWorker::ServiceWorker):
3402         (WebCore::ServiceWorker::~ServiceWorker):
3403         (WebCore::ServiceWorker::stop):
3404         * workers/service/ServiceWorker.h:
3405         * workers/service/server/SWClientConnection.cpp:
3406         (WebCore::SWClientConnection::updateWorkerState):
3407
3408 2017-11-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
3409
3410         [CG] PostScript images should be supported if they are sub-resource images
3411         https://bugs.webkit.org/show_bug.cgi?id=178502
3412         <rdar://problem/35102988>
3413
3414         Reviewed by Simon Fraser.
3415
3416         Make CachedImage detect the PostScript mime type and the file extension.
3417         Let PDFDocumentImage replaces the PostScript data with the equivalent PDF
3418         data and use it when creating the PDFDocument.
3419
3420         Test: fast/images/eps-as-image.html
3421
3422         * WebCore.xcodeproj/project.pbxproj:
3423         * loader/cache/CachedImage.cpp:
3424         (WebCore::CachedImage::isPDFRequest const):
3425         (WebCore::CachedImage::isPostScriptRequest const):
3426         These functions return whether the request is for a PDF or a PostScript 
3427         image. They check for the same conditions we do in WebPage::createPlugin().
3428
3429         (WebCore::CachedImage::createImage): Create a PDFDocumentImage for either
3430         a PDF or a PostScript image. For PostScript, the data will be converted
3431         to PDF when all the data is received.
3432
3433         (WebCore::CachedImage::updateBufferInternal): Use the size() of m_data
3434         instead of using the m_image->data() to setEncodedSize(). Image::m_data
3435         and CachedImage::m_data point to the same SharedBuffer.
3436
3437         (WebCore::CachedImage::convertedDataIfNeeded const): Convert the PostScript
3438         data to PDF if the system can convert it. If the same can't convert it,
3439         return null so loading the image will be canceled.
3440
3441         (WebCore::CachedImage::updateImageData): Get rid of the data argument since
3442         we always send the member m_data to this function.
3443
3444         (WebCore::CachedImage::finishLoading): Convert the PostScript data to PDF 
3445         data since all the data is received. Use m_data to set setEncodedSize().
3446
3447         * loader/cache/CachedImage.h:
3448         * platform/MIMETypeRegistry.cpp:
3449         (WebCore::MIMETypeRegistry::isPostScriptMIMEType):
3450         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
3451         * platform/MIMETypeRegistry.h:
3452         * platform/graphics/cg/PDFDocumentImage.cpp:
3453         (WebCore::PDFDocumentImage::PDFDocumentImage):
3454         (WebCore::PDFDocumentImage::convertPostScriptDataToPDF):
3455         * platform/graphics/cg/PDFDocumentImage.h:
3456
3457 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3458
3459         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
3460         https://bugs.webkit.org/show_bug.cgi?id=173793
3461
3462         Reviewed by Joseph Pecoraro.
3463
3464         Based on patch by Brian Burg.
3465
3466         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
3467         * Modules/encryptedmedia/InitDataRegistry.cpp:
3468         (WebCore::extractKeyIDsKeyids):
3469         (WebCore::sanitizeKeyids):
3470         * html/parser/XSSAuditorDelegate.cpp:
3471         (WebCore::XSSAuditorDelegate::generateViolationReport):
3472         * inspector/CommandLineAPIHost.cpp:
3473         (WebCore::CommandLineAPIHost::inspect):
3474         * inspector/CommandLineAPIHost.h:
3475         * inspector/InspectorCanvas.cpp:
3476         (WebCore::InspectorCanvas::recordAction):
3477         (WebCore::InspectorCanvas::releaseData):
3478         (WebCore::InspectorCanvas::indexForData):
3479         (WebCore::buildArrayForVector):
3480         (WebCore::InspectorCanvas::buildInitialState):
3481         (WebCore::InspectorCanvas::buildAction):
3482         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
3483         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
3484         (WebCore::InspectorCanvas::buildArrayForImageData):
3485         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
3486         * inspector/InspectorCanvas.h:
3487         * inspector/InspectorDatabaseResource.cpp:
3488         * inspector/InspectorOverlay.cpp:
3489         (WebCore::evaluateCommandInOverlay):
3490         (WebCore::InspectorOverlay::evaluateInOverlay):
3491         * inspector/InspectorOverlay.h:
3492         * inspector/InspectorShaderProgram.h:
3493         * inspector/InspectorStyleSheet.h:
3494         (WebCore::InspectorCSSId::InspectorCSSId):
3495         * inspector/TimelineRecordFactory.cpp:
3496         (WebCore::TimelineRecordFactory::createGenericRecord):
3497         (WebCore::TimelineRecordFactory::createFunctionCallData):
3498         (WebCore::TimelineRecordFactory::createConsoleProfileData):
3499         (WebCore::TimelineRecordFactory::createProbeSampleData):
3500         (WebCore::TimelineRecordFactory::createEventDispatchData):
3501         (WebCore::TimelineRecordFactory::createGenericTimerData):
3502         (WebCore::TimelineRecordFactory::createTimerInstallData):
3503         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
3504         (WebCore::TimelineRecordFactory::createTimeStampData):
3505         (WebCore::TimelineRecordFactory::createAnimationFrameData):
3506         (WebCore::createQuad):
3507         (WebCore::TimelineRecordFactory::createPaintData):
3508         (WebCore::TimelineRecordFactory::appendLayoutRoot):
3509         * inspector/TimelineRecordFactory.h:
3510         * inspector/agents/InspectorApplicationCacheAgent.cpp:
3511         * inspector/agents/InspectorApplicationCacheAgent.h:
3512         * inspector/agents/InspectorCSSAgent.cpp:
3513         (WebCore::computePseudoClassMask):
3514         (WebCore::InspectorCSSAgent::setStyleText):
3515         (WebCore::InspectorCSSAgent::setRuleSelector):
3516         (WebCore::InspectorCSSAgent::forcePseudoState):
3517         * inspector/agents/InspectorCSSAgent.h:
3518         * inspector/agents/InspectorDOMAgent.cpp:
3519         (WebCore::parseColor):
3520         (WebCore::parseConfigColor):
3521         (WebCore::parseQuad):
3522         (WebCore::InspectorDOMAgent::performSearch):
3523         (WebCore::InspectorDOMAgent::setSearchingForNode):
3524         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
3525         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
3526         (WebCore::InspectorDOMAgent::highlightRect):
3527         (WebCore::InspectorDOMAgent::highlightQuad):
3528         (WebCore::InspectorDOMAgent::innerHighlightQuad):
3529         (WebCore::InspectorDOMAgent::highlightSelector):
3530         (WebCore::InspectorDOMAgent::highlightNode):
3531         (WebCore::InspectorDOMAgent::highlightNodeList):
3532         (WebCore::InspectorDOMAgent::highlightFrame):
3533         * inspector/agents/InspectorDOMAgent.h:
3534         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
3535         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
3536         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
3537         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
3538         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
3539         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
3540         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
3541         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
3542         * inspector/agents/InspectorDOMDebuggerAgent.h:
3543         * inspector/agents/InspectorDOMStorageAgent.cpp:
3544         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
3545         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
3546         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
3547         (WebCore::InspectorDOMStorageAgent::findStorageArea):
3548         * inspector/agents/InspectorDOMStorageAgent.h:
3549         * inspector/agents/InspectorDatabaseAgent.cpp:
3550         * inspector/agents/InspectorIndexedDBAgent.cpp:
3551         (WebCore::Inspector::idbKeyFromInspectorObject):
3552         (WebCore::Inspector::idbKeyRangeFromKeyRange):
3553         (WebCore::InspectorIndexedDBAgent::requestData):
3554         * inspector/agents/InspectorIndexedDBAgent.h:
3555         * inspector/agents/InspectorNetworkAgent.cpp:
3556         (WebCore::buildObjectForHeaders):
3557         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
3558         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
3559         * inspector/agents/InspectorNetworkAgent.h:
3560         * inspector/agents/InspectorPageAgent.cpp:
3561         * inspector/agents/InspectorPageAgent.h:
3562         * inspector/agents/InspectorTimelineAgent.cpp:
3563         (WebCore::InspectorTimelineAgent::setInstruments):
3564         (WebCore::InspectorTimelineAgent::internalStart):
3565         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
3566         (WebCore::InspectorTimelineAgent::willLayout):
3567         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
3568         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
3569         (WebCore::InspectorTimelineAgent::willComposite):
3570         (WebCore::InspectorTimelineAgent::willPaint):
3571         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
3572         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
3573         (WebCore::InspectorTimelineAgent::appendRecord):
3574         (WebCore::InspectorTimelineAgent::sendEvent):
3575         (WebCore::InspectorTimelineAgent::createRecordEntry):
3576         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
3577         * inspector/agents/InspectorTimelineAgent.h:
3578         * page/csp/ContentSecurityPolicy.cpp:
3579         (WebCore::ContentSecurityPolicy::reportViolation const):
3580         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3581         (WebCore::parseJSONObject):
3582         (WebCore::parseLicenseFormat):
3583         (WebCore::parseLicenseReleaseAcknowledgementFormat):
3584         (WebCore::CDMInstanceClearKey::updateLicense):
3585         (WebCore::CDMInstanceClearKey::removeSessionData):
3586         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
3587         (WebCore::extractSinfData):
3588         * testing/Internals.cpp:
3589
3590 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
3591
3592         Use the TextStream indent manipulator in more places
3593         https://bugs.webkit.org/show_bug.cgi?id=180065
3594
3595         Reviewed by Sam Weinig.
3596
3597         Replace writeIndent() with << indent, and use an IndentScope in a few places.
3598
3599         * dom/ViewportArguments.cpp:
3600         (WebCore::operator<<):
3601         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3602         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
3603         * page/scrolling/ScrollingStateNode.cpp:
3604         (WebCore::ScrollingStateNode::dump const):
3605         * platform/graphics/FloatRoundedRect.cpp:
3606         (WebCore::operator<<):
3607         * platform/graphics/transforms/TransformationMatrix.cpp:
3608         (WebCore::operator<<):
3609
3610 2017-11-28  Noah Chase  <nchase@gmail.com>
3611
3612         Web Audio's AnalyserNode.fftSize cannot be greater than 2048 in Safari; spec says it can be up to 32768
3613         https://bugs.webkit.org/show_bug.cgi?id=180040
3614
3615         Reviewed by Alex Christensen.
3616
3617         I fixed up the existing test/output for realtimeanalyser-fft-sizing.
3618         one thing that I'm a bit unsure of here is whether or not there are other
3619         places in WebKit's Web Audio implementation that use fftSize and
3620         should have the wider range available (instead of capping out at
3621         2048). based on a quick naive scan I think that there are.
3622
3623         * Modules/webaudio/RealtimeAnalyser.cpp:
3624
3625 2017-11-28  Daniel Bates  <dabates@apple.com>
3626
3627         Add WebKitAdditions extension point to add user-agent stylesheet
3628         https://bugs.webkit.org/show_bug.cgi?id=179702
3629         <rdar://problem/35711147>
3630
3631         Reviewed by Andy Estes.
3632
3633         * DerivedSources.make: Write user agent stylesheet generation recipe in terms of the
3634         automatic variable $^, which represents the list of the names of all prerequisites
3635         for the rule. Make automatically expands the names in $^ up to their full absolute
3636         path.
3637
3638 2017-11-28  Daniel Bates  <dabates@apple.com>
3639
3640         [Cocoa] First pass at implementing alternative presentation button element
3641         https://bugs.webkit.org/show_bug.cgi?id=179785
3642         Part of <rdar://problem/34917108>
3643
3644         Reviewed by Brent Fulgham.
3645
3646         Implement support for substituting a button for one or more elements in a page.
3647         This is a first pass. We will refine the logic and the API/SPI in subsequent
3648         commits.
3649
3650         Tests: accessibility/alternative-presentation-button-input-type.html
3651                accessibility/alternative-presentation-button.html
3652                fast/forms/alternative-presentation-button/replace-and-remove.html
3653                fast/forms/alternative-presentation-button/replacement.html
3654
3655         * English.lproj/Localizable.strings: Add placeholder strings for localization.
3656         * SourcesCocoa.txt: Add some files.
3657         * WebCore.xcodeproj/project.pbxproj: Ditto.
3658         * dom/Element.h:
3659         * editing/Editor.cpp:
3660         (WebCore::Editor::clear): Clear out all substitutions. This is called whenever
3661         we are navigating between pages.
3662         (WebCore::Editor::substituteWithAlternativePresentationButton): Added.
3663         (WebCore::Editor::removeAlternativePresentationButton): Added.
3664         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Added.
3665         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Added.
3666         * editing/Editor.h:
3667         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Added.
3668         (WebCore::AlternativePresentationButtonSubstitution::AlternativePresentationButtonSubstitution):
3669         (WebCore::AlternativePresentationButtonSubstitution::initializeSavedDisplayStyles):
3670         (WebCore::AlternativePresentationButtonSubstitution::apply):
3671         (WebCore::AlternativePresentationButtonSubstitution::unapply):
3672         * editing/cocoa/AlternativePresentationButtonSubstitution.h:
3673         * html/HTMLInputElement.cpp:
3674         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Added.
3675         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Added.
3676         (WebCore::HTMLInputElement::createInputType): Extracted the logic to create the InputType from
3677         HTMLInputElement::updateType() to here and added logic to create the input type for the
3678         alternative presentation button. This input type is not web exposed.
3679         (WebCore::HTMLInputElement::updateType): Modified to take the name of the InputType object to
3680         create as an argument and pass it through to HTMLInputElement::createInputType() to actually
3681         create it. Reordered the logic for destroying the shadow tree of the old InputType, deallocating
3682         the old InputType, and assigning the new InputType such that we assign the new InputType,
3683         destroy the shadow tree of the old InputType, and deallocate the old InputType. This ordering
3684         allows AlternativePresentationButtonSubstitution::substitute() to avoid restoring the input
3685         type saved before the substitution when the input type is changed by the page as opposed to
3686         by SPI.
3687         (WebCore::HTMLInputElement::parseAttribute): Pass the parsed type.
3688         (WebCore::HTMLInputElement::willAttachRenderers): Ditto.
3689         * html/HTMLInputElement.h: Change visibility of removeShadowRoot() from private to public so
3690         that it can be called from AlternativePresentationButtonSubstitution.
3691         * html/InputType.h:
3692         (WebCore::InputType::alternativePresentationButtonElement const): Added.
3693         * html/InputTypeNames.cpp:
3694         (WebCore::InputTypeNames::alternativePresentationButton): Added.
3695         * html/InputTypeNames.h:
3696         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Added.
3697         (WebCore::AlternativePresentationButtonElement::create):
3698         (WebCore::AlternativePresentationButtonElement::AlternativePresentationButtonElement):
3699         (WebCore::AlternativePresentationButtonElement::insertedIntoAncestor):
3700         (WebCore::AlternativePresentationButtonElement::removedFromAncestor):
3701         (WebCore::AlternativePresentationButtonElement::didFinishInsertingNode):
3702         (WebCore::AlternativePresentationButtonElement::defaultEventHandler):
3703         * html/shadow/cocoa/AlternativePresentationButtonElement.h:
3704         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Added.
3705         (WebCore::AlternativePresentationButtonInputType::AlternativePresentationButtonInputType):
3706         (WebCore::AlternativePresentationButtonInputType::formControlType const):
3707         (WebCore::AlternativePresentationButtonInputType::appendFormData const):
3708         (WebCore::AlternativePresentationButtonInputType::supportsValidation const):
3709         (WebCore::AlternativePresentationButtonInputType::isTextButton const):
3710         (WebCore::AlternativePresentationButtonInputType::alternativePresentationButtonElement const):
3711         (WebCore::AlternativePresentationButtonInputType::createShadowSubtree):
3712         (WebCore::AlternativePresentationButtonInputType::destroyShadowSubtree):
3713         * html/shadow/cocoa/AlternativePresentationButtonInputType.h:
3714         * page/ChromeClient.h:
3715         * platform/LocalizedStrings.cpp:
3716         (WebCore::AXAlternativePresentationButtonLabel):
3717         (WebCore::alternativePresentationButtonTitle):
3718         (WebCore::alternativePresentationButtonSubtitle):
3719         * platform/LocalizedStrings.h:
3720         * testing/Internals.cpp:
3721         (WebCore::Internals::substituteWithAlternativePresentationButton): Added.
3722         (WebCore::Internals::removeAlternativePresentationButton): Added.
3723         * testing/Internals.h:
3724         * testing/Internals.idl:
3725
3726 2017-11-28  Commit Queue  <commit-queue@webkit.org>
3727
3728         Unreviewed, rolling out r225209.
3729         https://bugs.webkit.org/show_bug.cgi?id=180092
3730
3731         Tests are still timing out (Requested by ap on #webkit).
3732
3733         Reverted changeset:
3734
3735         "Pressing the space bar while watching a fullscreen video
3736         doesn't play or pause"
3737         https://bugs.webkit.org/show_bug.cgi?id=180033
3738         https://trac.webkit.org/changeset/225209
3739
3740 2017-11-28  Chris Dumez  <cdumez@apple.com>
3741
3742         Start exposing navigator.serviceWorker inside service workers
3743         https://bugs.webkit.org/show_bug.cgi?id=180087
3744
3745         Reviewed by Brady Eidson.
3746
3747         Start exposing navigator.serviceWorker inside service workers as per:
3748         - https://w3c.github.io/ServiceWorker/#navigator-serviceworker
3749
3750         Although the property is now exposed, the API on ServiceWorkerContainer is not
3751         supported yet inside service workers and the promise will be rejected. This will
3752         be implemented in a follow-up.
3753
3754         Test: http/tests/workers/service/WorkerNavigator_serviceWorker.html
3755
3756         * Sources.txt:
3757         * WebCore.xcodeproj/project.pbxproj:
3758         * bindings/js/JSWorkerNavigatorCustom.cpp: Added.
3759         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
3760         * page/WorkerNavigator.idl:
3761         * workers/service/ServiceWorker.idl:
3762         * workers/service/ServiceWorkerContainer.cpp:
3763         (WebCore::ServiceWorkerContainer::controller const):
3764         (WebCore::ServiceWorkerContainer::addRegistration):
3765         (WebCore::ServiceWorkerContainer::getRegistration):
3766         (WebCore::ServiceWorkerContainer::getRegistrations):
3767         * workers/service/ServiceWorkerContainer.idl:
3768         * workers/service/ServiceWorkerRegistration.cpp:
3769         (WebCore::ServiceWorkerRegistration::update):
3770         (WebCore::ServiceWorkerRegistration::unregister):
3771         * workers/service/ServiceWorkerRegistration.idl:
3772
3773 2017-11-28  Simon Fraser  <simon.fraser@apple.com>
3774
3775         Modernize GraphicsLayer dumping
3776         https://bugs.webkit.org/show_bug.cgi?id=180067
3777
3778         Reviewed by Sam Weinig.
3779
3780         Use the indent stream manipulator, and TextStream's built-in indent amount
3781         for GraphicsLayer dumping.
3782
3783         * platform/graphics/GraphicsLayer.cpp:
3784         (WebCore::GraphicsLayer::dumpLayer const):
3785         (WebCore::dumpChildren):
3786         (WebCore::GraphicsLayer::dumpProperties const):
3787         (WebCore::GraphicsLayer::layerTreeAsText const):
3788         * platform/graphics/GraphicsLayer.h:
3789         (WebCore::GraphicsLayer::dumpAdditionalProperties const):
3790         * platform/graphics/ca/GraphicsLayerCA.cpp:
3791         (WebCore::dumpInnerLayer):
3792         (WebCore::GraphicsLayerCA::dumpAdditionalProperties const):
3793         * platform/graphics/ca/GraphicsLayerCA.h:
3794
3795 2017-11-28  Antoine Quint  <graouts@apple.com>
3796
3797         Remove dead debugging code in modern media controls
3798         https://bugs.webkit.org/show_bug.cgi?id=180079
3799
3800         Reviewed by Eric Carlson.
3801
3802         This debug utility is no longer necessary and is just dead code.
3803
3804         * Modules/modern-media-controls/controls/scheduler.js:
3805         (const.scheduler.new.prototype.scheduleLayout):
3806         (const.scheduler.new.prototype.unscheduleLayout):
3807         (const.scheduler.new.prototype._requestFrameIfNeeded):
3808         (const.scheduler.new.prototype._frameDidFire):
3809         (const.scheduler.new.prototype._layout):
3810
3811 2017-11-28  Antoine Quint  <graouts@apple.com>
3812
3813         Skip back and forward buttons should not hard-code their numeric amount in localised strings
3814         https://bugs.webkit.org/show_bug.cgi?id=180077
3815
3816         Reviewed by Eric Carlson.
3817
3818         Split out the numeric value used in the skip forward and skip back localized strings to make
3819         it easier to localized the numeric value itself.
3820
3821         Test: media/modern-media-controls/localized-strings/replaced-string.html
3822
3823         * English.lproj/modern-media-controls-localized-strings.js:
3824         * Modules/modern-media-controls/main.js:
3825         (UIString):
3826
3827 2017-11-28  Antoine Quint  <graouts@apple.com>
3828
3829         Pressing the space bar while watching a fullscreen video doesn't play or pause
3830         https://bugs.webkit.org/show_bug.cgi?id=180033
3831         <rdar://problem/33610443>
3832
3833         Reviewed by Eric Carlson.
3834
3835         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3836         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3837         one of the media controls using the keyboard will not let the events we register for be dispatched
3838         this far along the event dispatch phase.
3839
3840         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3841
3842         * Modules/modern-media-controls/media/media-controller.js:
3843         (MediaController):
3844         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3845         lead to some extraneous unhandled promise console logging that pollutes test output.
3846         (MediaController.prototype.handleEvent):
3847
3848 2017-11-27  Tim Horton  <timothy_horton@apple.com>
3849
3850         Web Content process crashes when dragging a link in recovery mode
3851         https://bugs.webkit.org/show_bug.cgi?id=180058
3852         <rdar://problem/35172170>
3853
3854         Reviewed by Alexey Proskuryakov.
3855
3856         * platform/mac/DragImageMac.mm:
3857         (WebCore::LinkImageLayout::LinkImageLayout):
3858         LinkPresentation isn't available in the base system. Make it optional,
3859         and fall back to the full URL like we do on platforms where it doesn't
3860         exist at all.
3861
3862 2017-11-27  Chris Dumez  <cdumez@apple.com>
3863
3864         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h
3865         https://bugs.webkit.org/show_bug.cgi?id=180060
3866
3867         Reviewed by Alex Christensen.
3868
3869         Move callOnMainThreadAndWait() from SocketStreamHandleImplCFNet.cpp to MainThread.h so that it can be reused.
3870
3871         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3872         (WebCore::callOnMainThreadAndWait): Deleted.
3873
3874 2017-11-27  Matt Lewis  <jlewis3@apple.com>
3875
3876         Unreviewed, rolling out r225201.
3877
3878         This caused multiple tests to timeout consistently.
3879
3880         Reverted changeset:
3881
3882         "Pressing the space bar while watching a fullscreen video
3883         doesn't play or pause"
3884         https://bugs.webkit.org/show_bug.cgi?id=180033
3885         https://trac.webkit.org/changeset/225201
3886
3887 2017-11-27  Chris Dumez  <cdumez@apple.com>
3888
3889         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
3890         https://bugs.webkit.org/show_bug.cgi?id=180059
3891
3892         Reviewed by Geoffrey Garen.
3893
3894         NavigatorBase::serviceWorker() should return a reference instead of a raw pointer
3895         as it can never return null.
3896
3897         * bindings/js/JSNavigatorCustom.cpp:
3898         (WebCore::JSNavigator::visitAdditionalChildren):
3899         * dom/ScriptExecutionContext.cpp:
3900         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
3901         * page/NavigatorBase.cpp:
3902         (WebCore::NavigatorBase::serviceWorker):
3903         * page/NavigatorBase.h:
3904
3905 2017-11-27  Antoine Quint  <graouts@apple.com>
3906
3907         Pressing the space bar while watching a fullscreen video doesn't play or pause
3908         https://bugs.webkit.org/show_bug.cgi?id=180033
3909         <rdar://problem/33610443>
3910
3911         Reviewed by Eric Carlson.
3912
3913         We register a "keydown" event to track when the space bar is pressed, and if the media is playing
3914         in fullscreen, we toggle playback. This does not interfere with full keyboard access since activating
3915         one of the media controls using the keyboard will not let the events we register for be dispatched
3916         this far along the event dispatch phase.
3917
3918         Test: media/modern-media-controls/media-controller/media-controller-space-bar-toggle-playback.html
3919
3920         * Modules/modern-media-controls/media/media-controller.js:
3921         (MediaController):
3922         (MediaController.prototype.togglePlayback): Add a catch() statement since calling play() could sometime
3923         lead to some extraneous unhandled promise console logging that pollutes test output.
3924         (MediaController.prototype.handleEvent):
3925
3926 2017-11-27  Matt Lewis  <jlewis3@apple.com>
3927
3928         Unreviewed, rolling out r225173.
3929
3930         This caused multiple tests to timeout consistently.
3931
3932         Reverted changeset:
3933
3934         "Pressing the space bar while watching a fullscreen video
3935         doesn't play or pause"
3936         https://bugs.webkit.org/show_bug.cgi?id=180033
3937         https://trac.webkit.org/changeset/225173
3938
3939 2017-11-27  Chris Dumez  <cdumez@apple.com>
3940
3941         ASSERTION FAILED: addResult.isNewEntry WebCore::SWServerRegistration::addClientUsingRegistration(WebCore::ServiceWorkerClientIdentifier const&) + 141
3942         https://bugs.webkit.org/show_bug.cgi?id=180049
3943
3944         Reviewed by Brady Eidson.
3945
3946         SWServer::serviceWorkerStoppedControllingClient() was failing to remove the client from the
3947         SWServerRegistration in some cases. This is because we relied on the Service Worker Identifier
3948         to get the SWServerRegistration, via the corresponding SWServerServiceWorker object. However,
3949         It is possible for the SWServerServiceWorker to have been destroyed already.
3950
3951         In serviceWorkerStartedControllingClient / serviceWorkerStoppedControllingClient, we now
3952         pass the registration identifier, so that we are able to look up the registration directly,
3953         without going through the service worker object.
3954
3955         No new tests, already covered by imported/w3c/web-platform-tests/service-workers/service-worker/claim-affect-other-registration.https.html.
3956
3957         * dom/ScriptExecutionContext.cpp:
3958         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
3959         * workers/service/ServiceWorker.h:
3960         * workers/service/ServiceWorkerContainer.cpp:
3961         (WebCore::ServiceWorkerContainer::addRegistration):
3962         (WebCore::ServiceWorkerContainer::removeRegistration):
3963         * workers/service/ServiceWorkerData.cpp:
3964         (WebCore::ServiceWorkerData::isolatedCopy const):
3965         * workers/service/ServiceWorkerData.h:
3966         (WebCore::ServiceWorkerData::encode const):
3967         (WebCore::ServiceWorkerData::decode):
3968         * workers/service/server/SWClientConnection.h:
3969         * workers/service/server/SWServer.cpp:
3970         (WebCore::SWServer::addRegistration):
3971         (WebCore::SWServer::removeRegistration):
3972         (WebCore::SWServer::clearAll):
3973         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
3974         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
3975         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
3976         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
3977         (WebCore::SWServer::addClientServiceWorkerRegistration):
3978         (WebCore::SWServer::removeClientServiceWorkerRegistration):
3979         (WebCore::SWServer::serviceWorkerStartedControllingClient):
3980         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
3981         (WebCore::SWServer::installContextData):
3982         * workers/service/server/SWServer.h:
3983         * workers/service/server/SWServerWorker.cpp:
3984         (WebCore::SWServerWorker::SWServerWorker):
3985         * workers/service/server/SWServerWorker.h:
3986
3987 2017-11-27  Tim Horton  <timothy_horton@apple.com>
3988
3989         REGRESSION (r225142): Crashes when command clicking or force touching links
3990         https://bugs.webkit.org/show_bug.cgi?id=180055
3991         <rdar://problem/35703910>
3992
3993         Reviewed by Wenson Hsieh.
3994
3995         No new tests; affects an existing API test.
3996
3997         * editing/mac/DictionaryLookup.mm:
3998         (WebCore::tokenRange):
3999         The 'options' out argument from tokenRangeForString is autoreleased.
4000
4001 2017-11-27  Dean Jackson  <dino@apple.com>
4002
4003         Implement OffscreenCanvas.getContext("webgl")
4004         https://bugs.webkit.org/show_bug.cgi?id=180050
4005         <rdar://problem/35705473>
4006
4007         Reviewed by Sam Weinig.
4008
4009         Implement enough of getContext("webgl") to actually return an