Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-11  Darin Adler  <darin@apple.com>
2
3         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
4         https://bugs.webkit.org/show_bug.cgi?id=180340
5
6         Reviewed by Dan Bates.
7
8         * css/CSSFontFaceSet.h: Moved FontSelectionRequestKey and FontSelectionRequestKeyHash
9         here to be private members, and used a std::optional instead of a class for this.
10         Also use the new Hasher to compute the hash. Also added FontSelectionRequestKeyHashTraits.
11
12         * platform/graphics/FontDescription.cpp:
13         (WebCore::FontDescription::FontDescription): Updated since FontSelectionRequest
14         does not always have a constructor any more.
15
16         * platform/graphics/FontSelectionAlgorithm.h: Tweaked comments. Used "using" instead
17         of typedef. Formatted some trivial functions as single lines. Stopped using
18         NeverDestroyed for simple classes like FontSelectionValue; it's not needed unless
19         there is a destructor. Got rid of some incorrect use of const. Replaced some member
20         functions with non-member functions. Moved some function bodies out of class definitions.
21         Used a lot of constexpr functions.
22         (WebCore::FontSelectionRequest::tied const): Added so we can easily write both == and the
23         hash function without listing the data members.
24         (WebCore::add): Added an overload so we can hash things that include FontSelectionRequest.
25         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey): Changed this class to
26         use std::optional instead of a separate boolean for deleted values.
27         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue const): Ditto.
28         (WebCore::FontSelectionRequestKey::operator== const): Ditto.
29         (WebCore::FontSelectionRequestKeyHash::hash): Ditto.
30         (WebCore::FontSelectionRequestKeyHash::equal): Ditto.
31         (WebCore::FontSelectionCapabilities::tied const): Added so we can easily write both ==
32         and the hash function without listing the data members.
33         (WebCore::FontSelectionSpecifiedCapabilities::tied const): Ditto.
34         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm): Use make_unique instead of new.
35
36         * platform/graphics/cocoa/FontCacheCoreText.cpp:
37         (WebCore::findClosestFont): Move in the vector instead of copying it when creating a
38         FontSelectionAlgorithm object.
39
40 2017-12-11  Jer Noble  <jer.noble@apple.com>
41
42         [EME] support update() for FairPlayStreaming in Modern EME API
43         https://bugs.webkit.org/show_bug.cgi?id=180542
44
45         Reviewed by Eric Carlson.
46
47         Support the updateLicense() method in CDMInstanceFairPlayStreaming. Also, support adding a
48         AVStreamDataParser to the AVContentKeySession.
49
50         Drive-by fixes:
51
52         - Sometimes, AVFoundation will give us a base64 encoded string with spaces url-disallowed
53         characters, so use base64Decode() rather than base64URLDecode().
54
55         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
56         (WebCore::validFairPlayStreamingSchemes):
57         (WebCore::extractSinfData):
58         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
59         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
60         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
61         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
62         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
63         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
64         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstance const):
65         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
66         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
67         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
68         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
69         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
70         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
71         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
72         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
73
74 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
75
76         Web Inspector: Optionally log WebKit log parameters as JSON
77         https://bugs.webkit.org/show_bug.cgi?id=180529
78         <rdar://problem/35909462>
79
80         Reviewed by Joseph Pecoraro.
81
82         * dom/Document.cpp:
83         (WebCore::Document::didLogMessage):Update for API change. Don't check for main thread, that
84         is already done in addConsoleMessage.
85         * dom/Document.h:
86
87         * html/HTMLMediaElement.cpp:
88         (WebCore::HTMLMediaElement::updatePlayState): Cleanup logging.
89
90         * html/track/DataCue.cpp:
91         (WebCore::DataCue::toJSONString const): Serialize to JSON string.
92         (WebCore::DataCue::toString const): Deleted.
93         * html/track/DataCue.h:
94         (WTF::LogArgument<WebCore::DataCue>::toString):
95
96         * html/track/TextTrackCue.cpp:
97         (WebCore::TextTrackCue::toJSON const): Ditto.
98         (WebCore::TextTrackCue::toJSONString const):
99         (WebCore::TextTrackCue::toString const): Deleted.
100         * html/track/TextTrackCue.h:
101         (WTF::LogArgument<WebCore::TextTrackCue>::toString):
102
103         * html/track/TextTrackCueGeneric.cpp:
104         (WebCore::TextTrackCueGeneric::toJSONString const): Ditto.
105         (WebCore::TextTrackCueGeneric::toString const): Deleted.
106         * html/track/TextTrackCueGeneric.h:
107         (WTF::LogArgument<WebCore::TextTrackCueGeneric>::toString):
108
109         * html/track/VTTCue.cpp:
110         (WebCore::VTTCue::toJSONString const): Ditto.
111         (WebCore::VTTCue::toString const): Deleted.
112         * html/track/VTTCue.h:
113         (WTF::LogArgument<WebCore::VTTCue>::toString):
114
115         * platform/graphics/InbandTextTrackPrivateClient.h:
116         (WebCore::GenericCueData::toJSONString const): Ditto.
117         (WTF::LogArgument<WebCore::GenericCueData>::toString):
118         (WebCore::GenericCueData::toString const): Deleted.
119
120         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
121         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Cleanup logging.
122         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Ditto.
123         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Log the entire cue.
124         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): Cleanup logging.
125
126         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
127         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const): Don't log, it isn't
128         interesting and happens frequently.
129         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const): Ditto.
130
131         * platform/graphics/iso/ISOVTTCue.cpp:
132         (WebCore::ISOWebVTTCue::toJSONString const): Serialize to JSON string.
133
134         * platform/graphics/iso/ISOVTTCue.h:
135         (WTF::LogArgument<WebCore::ISOWebVTTCue>::toString): Ditto.
136
137 2017-12-11  Youenn Fablet  <youenn@apple.com>
138
139         Use VCP H264 encoder for platforms supporting it
140         https://bugs.webkit.org/show_bug.cgi?id=179076
141         rdar://problem/35180773
142
143         Reviewed by Eric Carlson.
144
145         Covered by existing test coverage.
146
147         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
148         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
149         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
150         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
151         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
152
153 2017-12-11  Chris Dumez  <cdumez@apple.com>
154
155         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
156         https://bugs.webkit.org/show_bug.cgi?id=180669
157
158         Reviewed by Youenn Fablet.
159
160         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
161         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
162
163         * WebCore.xcodeproj/project.pbxproj:
164         * dom/Document.cpp:
165         (WebCore::Document::setServiceWorkerConnection):
166         * workers/service/SWClientConnection.h:
167         * workers/service/ServiceWorker.cpp:
168         (WebCore::ServiceWorker::postMessage):
169         * workers/service/ServiceWorkerClient.cpp:
170         (WebCore::ServiceWorkerClient::getOrCreate):
171         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
172         * workers/service/ServiceWorkerClient.h:
173         (WebCore::ServiceWorkerClient::identifier const):
174         * workers/service/ServiceWorkerClientData.cpp:
175         (WebCore::ServiceWorkerClientData::isolatedCopy const):
176         (WebCore::ServiceWorkerClientData::from):
177         * workers/service/ServiceWorkerClientData.h:
178         (WebCore::ServiceWorkerClientData::encode const):
179         (WebCore::ServiceWorkerClientData::decode):
180         * workers/service/ServiceWorkerClientInformation.h: Removed.
181         * workers/service/ServiceWorkerClients.cpp:
182         (WebCore::didFinishGetRequest):
183         (WebCore::ServiceWorkerClients::get):
184         (WebCore::matchAllCompleted):
185         * workers/service/ServiceWorkerTypes.h:
186         * workers/service/ServiceWorkerWindowClient.cpp:
187         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
188         * workers/service/ServiceWorkerWindowClient.h:
189         * workers/service/context/SWContextManager.cpp:
190         (WebCore::SWContextManager::postMessageToServiceWorker):
191         * workers/service/context/SWContextManager.h:
192         * workers/service/context/ServiceWorkerThread.cpp:
193         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
194         * workers/service/context/ServiceWorkerThread.h:
195         * workers/service/server/SWServer.cpp:
196         (WebCore::SWServer::findClientByIdentifier):
197         (WebCore::SWServer::matchAll):
198         (WebCore::SWServer::claim):
199         (WebCore::SWServer::registerServiceWorkerClient):
200         * workers/service/server/SWServer.h:
201         * workers/service/server/SWServerToContextConnection.h:
202         * workers/service/server/SWServerWorker.h:
203
204 2017-12-11  Daniel Bates  <dabates@apple.com>
205
206         Fix the macOS Sierra build following r225179
207         (https://bugs.webkit.org/show_bug.cgi?id=180011)
208
209         Substitute TARGET_MAC_OS_X_VERSION_LESS_THAN_101300 for TARGET_MAC_OS_X_VERSION_LESS_THAN_1013000.
210
211         * Configurations/WebCore.xcconfig:
212
213 2017-12-11  Zalan Bujtas  <zalan@apple.com>
214
215         Make FrameView objects IsoHeap allocated
216         https://bugs.webkit.org/show_bug.cgi?id=180668
217         <rdar://problem/35976738>
218
219         Reviewed by Simon Fraser.
220
221         Related to <https://trac.webkit.org/changeset/225719/webkit>
222
223         * page/FrameView.cpp:
224         * page/FrameView.h:
225
226 2017-12-11  Antoine Quint  <graouts@apple.com>
227
228         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
229         https://bugs.webkit.org/show_bug.cgi?id=180647
230
231         Reviewed by Dean Jackson.
232
233         Actually fix Windows build this time.
234
235         * animation/AnimationPlaybackEventInit.h:
236
237 2017-12-11  Antoine Quint  <graouts@apple.com>
238
239         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
240         https://bugs.webkit.org/show_bug.cgi?id=180647
241         <rdar://problem/35966325>
242
243         Reviewed by Dean Jackson.
244
245         Unreviewed, fix Windows build.
246
247         * animation/AnimationPlaybackEventInit.h:
248
249 2017-12-11  Zalan Bujtas  <zalan@apple.com>
250
251         FloatingObjects/FloatingObject classes should hold weak references to renderers
252         https://bugs.webkit.org/show_bug.cgi?id=180627
253         <rdar://problem/35954069>
254
255         Reviewed by Antti Koivisto.
256
257         * rendering/FloatingObjects.cpp:
258         (WebCore::FloatingObject::FloatingObject):
259         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
260         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
261         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
262         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
263         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
264         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
265         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
266         (WebCore::FloatingObjects::FloatingObjects):
267         (WebCore::FloatingObjects::clearLineBoxTreePointers):
268         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
269         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
270         (WebCore::FloatingObjects::logicalLeftOffset):
271         (WebCore::FloatingObjects::logicalRightOffset):
272         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
273         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
274         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
275         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
276         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
277         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
278         * rendering/FloatingObjects.h:
279         (WebCore::FloatingObject::renderer const):
280         (WebCore::FloatingObjects::renderer const):
281
282 2017-12-11  David Quesada  <david_quesada@apple.com>
283
284         Turn on ENABLE_APPLICATION_MANIFEST
285         https://bugs.webkit.org/show_bug.cgi?id=180562
286         rdar://problem/35924737
287
288         Reviewed by Geoffrey Garen.
289
290         * Configurations/FeatureDefines.xcconfig:
291         * loader/LinkLoader.cpp:
292         (WebCore::createLinkPreloadResourceClient):
293         * loader/cached/CachedResourceRequest.cpp:
294             Add a missing #include that was implicitly added in the unified source when
295             the feature is disabled.
296
297 2017-12-11  Dean Jackson  <dino@apple.com>
298
299         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
300         https://bugs.webkit.org/show_bug.cgi?id=180652
301         <rdar://problem/35969611>
302
303         Reviewed by Antoine Quint.
304
305         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
306         to the feature.
307
308         Test: fast/canvas/offscreen-enabled.html
309
310         * bindings/js/WebCoreBuiltinNames.h:
311         * html/ImageBitmap.idl:
312         * html/OffscreenCanvas.idl:
313         * page/RuntimeEnabledFeatures.h:
314         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
315         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
316         * page/WindowOrWorkerGlobalScope.idl:
317
318 2017-12-11  Antoine Quint  <graouts@apple.com>
319
320         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
321         https://bugs.webkit.org/show_bug.cgi?id=180647
322         <rdar://problem/35966325>
323
324         Reviewed by Dean Jackson.
325
326         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
327         as the first step towards dispatching animation "finish" and "cancel" events.
328
329         Animation playback events will be dispatched on Animation objects and expose the timeline time
330         and animation current time at the time they were constructed. Dispatch itself, which will be
331         the focus of the next patch, is not synchronous, so it's important to track those values
332         at creation time.
333
334         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
335         will show progressions.
336
337         * CMakeLists.txt:
338         * DerivedSources.make:
339         * Sources.txt:
340         * WebCore.xcodeproj/project.pbxproj:
341         * animation/AnimationPlaybackEvent.cpp: Added.
342         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
343         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
344         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
345         * animation/AnimationPlaybackEvent.h: Added.
346         * animation/AnimationPlaybackEvent.idl: Added.
347         * animation/AnimationPlaybackEventInit.h: Added.
348         * animation/AnimationPlaybackEventInit.idl: Added.
349         * bindings/js/WebCoreBuiltinNames.h:
350         * dom/EventNames.in:
351
352 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
353
354         [WinCairo] DumpRenderTree times out for all non-http tests
355         https://bugs.webkit.org/show_bug.cgi?id=180571
356
357         Reviewed by Alex Christensen.
358
359         Bug fix on processing the curl event for file protocol.
360
361         No new tests. This fix is to run existing tests.
362
363         * platform/network/curl/CurlRequest.cpp:
364         (WebCore::CurlRequest::completeDidReceiveResponse):
365         * platform/network/curl/CurlRequest.h:
366         (WebCore::CurlRequest::isCompleted const):
367         (WebCore::CurlRequest::isCancelled const):
368         (WebCore::CurlRequest::isCompletedOrCancelled const):
369
370 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
371
372         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
373         https://bugs.webkit.org/show_bug.cgi?id=180287
374
375         Reviewed by Darin Adler.
376
377         In r221931 we moved the stretch phase as the last step of
378         the track sizing algorithm.
379         However this introduced a regression as we were no longer
380         taking into account the grid container min-width|height constraints
381         during this step.
382
383         The CSS WG modified the spec so it now defines what to do
384         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
385           "If the free space is indefinite, but the grid container
386            has a definite min-width/height, use that size to calculate
387            the free space for this step instead."
388
389         This patch adds a new method
390         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
391         When we're in the DefiniteSizeStrategy it just returns the current
392         free space.
393         For the IndefiniteSizeStrategy in the columns case we don't need
394         any special computation (the same that happens in
395         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
396         of the grid container (respecting min-width|height properties)
397         to calculate the free space.
398
399         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
400
401         * rendering/GridTrackSizingAlgorithm.cpp:
402         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
403         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
404         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
405         * rendering/GridTrackSizingAlgorithm.h:
406
407 2017-12-10  Minsheng Liu  <lambda@liu.ms>
408
409         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
410         https://bugs.webkit.org/show_bug.cgi?id=179682
411
412         Reviewed by Frédéric Wang.
413
414         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
415         during paint() rather than layout(), which leads to both end user confusion
416         and many unexpected behaviors. This patch rewrites
417         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
418         to both eliminate the issue and make operator stretching more standard
419         conforming.
420
421         A test is added to check the stretch width of stretchy operators in various
422         scenarios:
423         mathml/opentype/munderover-stretch-width.html
424
425         A previous test is updated:
426         mathml/opentype/opentype-stretchy-horizontal.html
427
428         * rendering/mathml/RenderMathMLOperator.cpp:
429         (WebCore::RenderMathMLOperator::stretchTo):
430         (WebCore::RenderMathMLOperator::resetStretchSize):
431         (WebCore::RenderMathMLOperator::paint):
432         * rendering/mathml/RenderMathMLOperator.h:
433         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
434         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
435         * rendering/mathml/RenderMathMLUnderOver.cpp:
436         (WebCore::toHorizontalStretchyOperator):
437         (WebCore::fixLayoutAfterStretch):
438         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
439
440 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
441
442         Unreviewed, follow-up patch after r225470
443         https://bugs.webkit.org/show_bug.cgi?id=180308
444
445         * Modules/webdatabase/SQLTransaction.cpp:
446         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
447         Use consistent operands.
448
449         * bindings/js/JSCallbackData.h:
450         (WebCore::JSCallbackData::JSCallbackData):
451         Use class field initializer.
452
453         * xml/parser/XMLDocumentParserLibxml2.cpp:
454         (WebCore::openFunc):
455         Use consistent operands.
456
457 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
458
459         iOS: Crash in Document::updateLayout() via Document::processViewport
460         https://bugs.webkit.org/show_bug.cgi?id=180619
461         <rdar://problem/35717575>
462
463         Reviewed by Zalan Bujtas.
464
465         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
466         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
467
468         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
469         since updating the viewport configuration results in a lot of related code running in response,
470         and making sure all that code never tries to execute an author script is not attainable in the short term,
471         and a maintenance nightmare in the long term.
472
473         Test: media/ios/viewport-change-with-video.html
474
475         * html/HTMLMetaElement.cpp:
476         (WebCore::HTMLMetaElement::insertedIntoAncestor):
477         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
478         * html/HTMLMetaElement.h:
479
480 2017-12-08  Zalan Bujtas  <zalan@apple.com>
481
482         Document::updateLayout() could destroy current frame.
483         https://bugs.webkit.org/show_bug.cgi?id=180525
484         <rdar://problem/35906836>
485
486         Reviewed by Simon Fraser.
487
488         Early return when Document::updateLayout() triggers Frame destruction.
489
490         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
491
492         * dom/TreeScope.cpp:
493         (WebCore::absolutePointIfNotClipped):
494
495 2017-12-08  Chris Dumez  <cdumez@apple.com>
496
497         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
498         https://bugs.webkit.org/show_bug.cgi?id=180615
499
500         Reviewed by Brady Eidson.
501
502         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
503         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
504
505         No new tests, rebaselined existing test.
506
507         * workers/DedicatedWorkerGlobalScope.idl:
508         * workers/WorkerGlobalScope.idl:
509         * workers/service/ServiceWorkerGlobalScope.idl:
510
511 2017-12-08  Brady Eidson  <beidson@apple.com>
512
513         Delay some service worker operations until after the database import completes.
514         https://bugs.webkit.org/show_bug.cgi?id=180573
515
516         Reviewed by Chris Dumez.
517
518         No new tests (Not testable yet).
519
520         Right after the storage process launches it starts importing registration records.
521         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
522         are invalid, as they rely on those in-memory records being in place.
523         
524         This patch delays certain things until after the initial origin table import is complete.
525         
526         * workers/service/server/RegistrationStore.cpp:
527         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
528
529         * workers/service/server/SWOriginStore.h:
530
531         * workers/service/server/SWServer.cpp:
532         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
533           import was completed.
534         (WebCore::SWServer::addRegistrationFromStore):
535         * workers/service/server/SWServer.h:
536
537 2017-12-08  Youenn Fablet  <youenn@apple.com>
538
539         Service Worker should use a correct user agent
540         https://bugs.webkit.org/show_bug.cgi?id=180566
541         <rdar://problem/35926295>
542
543         Reviewed by Chris Dumez.
544
545         Test: http/wpt/service-workers/useragent.https.html
546
547         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
548         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
549         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
550
551         * loader/EmptyFrameLoaderClient.h:
552         * workers/service/context/ServiceWorkerThread.cpp:
553         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
554         * workers/service/context/ServiceWorkerThread.h:
555         * workers/service/context/ServiceWorkerThreadProxy.cpp:
556         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
557         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
558         * workers/service/context/ServiceWorkerThreadProxy.h:
559
560 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
561
562         Wrong caret position for input field inside a fixed position parent on iOS 11
563         https://bugs.webkit.org/show_bug.cgi?id=176896
564         rdar://problem/33726145
565
566         Reviewed by Tim Horton.
567
568         In r219668 I added code to compute a layout viewport rect in the web process, so that
569         after programmatic scrolling, getBoundingClientRect() would return the correct values.
570         However, that computation sometimes used a different visual viewport than the UI process,
571         resulting in a different layout viewport being set. This would happen when the keyboard
572         was visible, and the combination of this and zooming when focusing an input would result
573         in a state where the scrolling tree contained notes computed with the bad layout viewport.
574         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
575         elements contained the focused input.
576
577         Fix by passing to the web process the same visual viewport rect that the UI process is using,
578         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
579         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
580         on FrameView when different from the normal visual viewport, and return it from
581         visualViewportRect().
582
583         Some other minor logging changes.
584
585         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
586
587         * page/FrameView.cpp:
588         (WebCore::FrameView::setVisualViewportOverrideRect):
589         (WebCore::FrameView::updateLayoutViewport):
590         (WebCore::FrameView::visualViewportRect const):
591         * page/FrameView.h:
592         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
593         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
594
595 2017-12-08  Zalan Bujtas  <zalan@apple.com>
596
597         Make inline box objects IsoHeap allocated.
598         https://bugs.webkit.org/show_bug.cgi?id=180556
599         <rdar://problem/35923629>
600
601         Reviewed by Filip Pizlo.
602
603         * rendering/EllipsisBox.cpp:
604         * rendering/EllipsisBox.h:
605         * rendering/InlineBox.cpp:
606         * rendering/InlineBox.h:
607         * rendering/InlineElementBox.cpp:
608         * rendering/InlineElementBox.h:
609         * rendering/InlineFlowBox.cpp:
610         * rendering/InlineFlowBox.h:
611         * rendering/InlineTextBox.cpp:
612         * rendering/InlineTextBox.h:
613         * rendering/RootInlineBox.cpp:
614         * rendering/RootInlineBox.h:
615         * rendering/TrailingFloatsRootInlineBox.h:
616         * rendering/svg/SVGInlineFlowBox.cpp:
617         * rendering/svg/SVGInlineFlowBox.h:
618         * rendering/svg/SVGInlineTextBox.cpp:
619         * rendering/svg/SVGInlineTextBox.h:
620         * rendering/svg/SVGRootInlineBox.cpp:
621         * rendering/svg/SVGRootInlineBox.h:
622
623 2017-12-08  Chris Dumez  <cdumez@apple.com>
624
625         Clearing all Website Data should remove service worker registrations on disk
626         https://bugs.webkit.org/show_bug.cgi?id=180558
627
628         Reviewed by Youenn Fablet.
629
630         Clear service worker registrations on disk in addition to the ones in memory.
631
632         * workers/service/server/RegistrationDatabase.cpp:
633         (WebCore::v1RecordsTableSchema):
634         (WebCore::v1RecordsTableSchemaAlternate):
635         (WebCore::databaseFilename):
636         Make sure these always get called from the background thread since they use
637         a static string.
638
639         (WebCore::RegistrationDatabase::RegistrationDatabase):
640         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
641         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
642         file unnecessarily.
643
644         (WebCore::RegistrationDatabase::databasePath const):
645         New method which returns the database file path.
646
647         (WebCore::RegistrationDatabase::openSQLiteDatabase):
648
649         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
650         New methods which imports records if the database file exist. It the database file does
651         not exist, it does not create it.
652
653         (WebCore::RegistrationDatabase::pushChanges):
654         Call completion handler when changes are pushed.
655
656         (WebCore::RegistrationDatabase::clearAll):
657         Close the database if it is open, then remove the database files.
658
659         (WebCore::RegistrationDatabase::doPushChanges):
660         If the database is not already open, we now open it when trying to write changes for
661         the first time.
662
663         * workers/service/server/RegistrationDatabase.h:
664         * workers/service/server/RegistrationStore.cpp:
665         (WebCore::RegistrationStore::clearAll):
666         (WebCore::RegistrationStore::flushChanges):
667         * workers/service/server/RegistrationStore.h:
668
669         * workers/service/server/SWServer.cpp:
670         (WebCore::SWServer::clearAll):
671         (WebCore::SWServer::clear):
672         Also clear the database.
673
674         * workers/service/server/SWServer.h:
675
676         * workers/service/server/SWServerWorker.cpp:
677         (WebCore::SWServerWorker::terminate):
678         Only call SWServer::terminateWorker() if the worker is running. Otherwise, we hit
679         an assertion when clearing a registration would worker was already terminated.
680
681 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
682
683         ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
684         https://bugs.webkit.org/show_bug.cgi?id=180520
685         <rdar://problem/35900764>
686
687         Reviewed by Brian Burg.
688
689         * inspector/agents/worker/ServiceWorkerAgent.cpp:
690         (WebCore::ServiceWorkerAgent::getInitializationInfo):
691         * inspector/agents/worker/ServiceWorkerAgent.h:
692         Add initial script content to initialization so we always at least have main resource content.
693
694 2017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
695
696         ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
697         https://bugs.webkit.org/show_bug.cgi?id=180506
698
699         Reviewed by Brian Burg.
700
701         No test as this only happens inside a ServiceWorker inspector which
702         we don't yet have a way to test. In a Page Inspector, the
703         CacheStorage.add network request already behaves as expected.
704
705         * inspector/NetworkResourcesData.cpp:
706         (WebCore::NetworkResourcesData::responseReceived):
707         (WebCore::shouldBufferResourceData):
708         * inspector/NetworkResourcesData.h:
709         (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
710         (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
711         Provide a way to force buffering in NetworkResourceData.
712
713         * inspector/agents/InspectorNetworkAgent.cpp:
714         (WebCore::InspectorNetworkAgent::didReceiveResponse):
715         * inspector/agents/InspectorNetworkAgent.h:
716         * inspector/agents/page/PageNetworkAgent.h:
717         * inspector/agents/worker/WorkerNetworkAgent.h:
718         Enable force buffering in a Worker Network Agent.
719
720 2017-12-08  Daniel Bates  <dabates@apple.com>
721
722         Remove unnecessary prefix from AutoFillButtonType enumerators
723         https://bugs.webkit.org/show_bug.cgi?id=180512
724
725         Reviewed by Tim Horton.
726
727         * testing/Internals.cpp:
728         (WebCore::toAutoFillButtonType):
729         * testing/Internals.h:
730         * testing/Internals.idl:
731
732 2017-12-08  Dean Jackson  <dino@apple.com>
733
734         Implement transferToImageBitmap for WebGL offscreen canvas objects
735         https://bugs.webkit.org/show_bug.cgi?id=180603
736         <rdar://problem/34147143>
737
738         Reviewed by Sam Weinig.
739
740         Implement the basic version of creating an ImageBitmap from an
741         OffscreenCanvas that is using a WebGL context.
742
743         Tests: http/wpt/offscreen-canvas/transferToImageBitmap-empty.html
744                http/wpt/offscreen-canvas/transferToImageBitmap-webgl.html
745
746         * html/ImageBitmap.cpp:
747         (WebCore::ImageBitmap::create): Add a new constructor to be used by OffscreenCanvas.
748         Creates a blank ImageBitmap.
749         * html/ImageBitmap.h:
750
751         * html/OffscreenCanvas.cpp:
752         (WebCore::OffscreenCanvas::transferToImageBitmap): Create a new ImageBitmap
753         and paint the current canvas into it.
754
755 2017-12-08  Youenn Fablet  <youenn@apple.com>
756
757         WebServiceWorkerProvider should use Cancellation error to notify DTL that it cannot handle a fetch
758         https://bugs.webkit.org/show_bug.cgi?id=180584
759
760         Reviewed by Alex Christensen.
761
762         Previously, for each cross origin fetch that is going through a service worker and service worker is not handling the fetch,
763         we return an AccessControl error so that DocumentThreadableLoader will do preflight and regular load through the network.
764         This error is wrongly logged in the Inspector.
765         Change error type to Cancellation so that the Inspector does not log it.
766
767         * loader/DocumentThreadableLoader.cpp:
768         (WebCore::DocumentThreadableLoader::didFail):
769
770 2017-12-08  Youenn Fablet  <youenn@apple.com>
771
772         Service Worker should use a correct SessionID
773         https://bugs.webkit.org/show_bug.cgi?id=180585
774
775         Reviewed by Alex Christensen.
776
777         Test: http/tests/workers/service/serviceworker-private-browsing.https.html
778
779         Store SessionID in SWServer and send it as part of service worker instantiation.
780
781         * workers/service/server/SWServer.cpp:
782         (WebCore::SWServer::SWServer):
783         (WebCore::SWServer::installContextData):
784         (WebCore::SWServer::runServiceWorker):
785         * workers/service/server/SWServer.h:
786         * workers/service/server/SWServerToContextConnection.h:
787
788 2017-12-08  Youenn Fablet  <youenn@apple.com>
789
790         FetchResponse should keep unfiltered ResourceResponse so that it can be used in Service Worker
791         https://bugs.webkit.org/show_bug.cgi?id=179641
792         <rdar://problem/35923570>
793
794         Reviewed by Alex Christensen.
795
796         Covered by existing rebased tests.
797
798         FetchResponse will now store an unfiltered response.
799         If it needs to expose it to JavaScript, it will create a filtered response lazily.
800         This allows service worker to send back to web pages, opaque responses containing every information.
801
802         Updating Document::initSecurityContext so that any document loaded with a response whose tainting is Opaque gets a unique origin.
803         This ensures cross-origin checks to work if service worker returns such a response on a same origin URL.
804
805         Updated SubresourceLoader to check cross origin service worker responses based on their tainting.
806
807         * Modules/fetch/FetchResponse.cpp:
808         (WebCore::FetchResponse::create):
809         (WebCore::FetchResponse::error):
810         (WebCore::FetchResponse::redirect):
811         (WebCore::FetchResponse::FetchResponse):
812         (WebCore::FetchResponse::clone):
813         (WebCore::FetchResponse::url const):
814         (WebCore::FetchResponse::filteredResponse const):
815         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
816         (WebCore::FetchResponse::resourceResponse const):
817         * Modules/fetch/FetchResponse.h:
818         (WebCore::FetchResponse::create): Deleted.
819         * dom/Document.cpp:
820         (WebCore::Document::initSecurityContext):
821         * loader/SubresourceLoader.cpp:
822         (WebCore::SubresourceLoader::willSendRequestInternal):
823         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
824
825 2017-12-08  David Quesada  <david_quesada@apple.com>
826
827         ApplicationManifestParser should strip whitespace from the raw input
828         https://bugs.webkit.org/show_bug.cgi?id=180539
829         rdar://problem/35915075
830
831         Reviewed by Joseph Pecoraro.
832
833         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
834         (WebCore::ApplicationManifestParser::parseManifest):
835
836 2017-12-08  Eric Carlson  <eric.carlson@apple.com>
837
838         Move Logger from PAL to WTF so it can be used outside of WebCore
839         https://bugs.webkit.org/show_bug.cgi?id=180561
840
841         Reviewed by Alex Christensen.
842
843         No new tests, existing API test updated.
844
845         * Modules/mediastream/PeerConnectionBackend.h:
846         * Modules/mediastream/RTCPeerConnection.h:
847         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
848         (PAL::LogArgument<webrtc::RTCStats>::toString): Deleted.
849         * dom/Document.cpp:
850         * dom/Document.h:
851         * html/HTMLMediaElement.cpp:
852         (PAL::LogArgument<WebCore::URL>::toString): Deleted.
853         * html/HTMLMediaElement.h:
854         * html/HTMLMediaElementEnums.h:
855         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): Deleted.
856         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): Deleted.
857         * html/MediaElementSession.cpp:
858         (WebCore::MediaElementSession::logger const):
859         * html/MediaElementSession.h:
860         * html/track/DataCue.h:
861         (PAL::LogArgument<WebCore::DataCue>::toString): Deleted.
862         * html/track/TextTrackCue.h:
863         (PAL::LogArgument<WebCore::TextTrackCue>::toString): Deleted.
864         * html/track/TextTrackCueGeneric.h:
865         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString): Deleted.
866         * html/track/TrackBase.cpp:
867         (WebCore::nullLogger):
868         (WebCore::TrackBase::TrackBase):
869         * html/track/TrackBase.h:
870         * html/track/VTTCue.h:
871         (PAL::LogArgument<WebCore::VTTCue>::toString): Deleted.
872         * platform/graphics/InbandTextTrackPrivate.h:
873         * platform/graphics/InbandTextTrackPrivateClient.h:
874         (PAL::LogArgument<WebCore::GenericCueData>::toString): Deleted.
875         * platform/graphics/MediaPlayer.cpp:
876         (WebCore::nullLogger):
877         (WebCore::MediaPlayer::mediaPlayerLogger):
878         * platform/graphics/MediaPlayer.h:
879         (WTF::LogArgument<MediaTime>::toString):
880         (PAL::LogArgument<WTF::MediaTime>::toString): Deleted.
881         * platform/graphics/MediaPlayerEnums.h:
882         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString): Deleted.
883         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString): Deleted.
884         * platform/graphics/TrackPrivateBase.cpp:
885         (WebCore::TrackPrivateBase::setLogger):
886         * platform/graphics/TrackPrivateBase.h:
887         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
888         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
889         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
890         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
891         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
892         * platform/mediastream/RTCIceConnectionState.h:
893         (PAL::LogArgument<WebCore::RTCIceConnectionState>::toString): Deleted.
894         * platform/mediastream/RTCIceGatheringState.h:
895         (PAL::LogArgument<WebCore::RTCIceGatheringState>::toString): Deleted.
896         * platform/mediastream/RTCPeerConnectionState.h:
897         (PAL::LogArgument<WebCore::RTCPeerConnectionState>::toString): Deleted.
898         * platform/mediastream/RTCSignalingState.h:
899         (PAL::LogArgument<WebCore::RTCSignalingState>::toString): Deleted.
900         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
901
902 2017-12-08  Yusuke Suzuki  <utatane.tea@gmail.com>
903
904         Remove pthread_once in favor of dispatch_once
905         https://bugs.webkit.org/show_bug.cgi?id=180591
906
907         Reviewed by Saam Barati.
908
909         No behavior change.
910
911         * platform/mac/WebCoreNSURLExtras.mm:
912         (WebCore::allCharactersInIDNScriptWhiteList):
913         (WebCore::readIDNScriptWhiteList): Deleted.
914
915 2017-12-08  Chris Dumez  <cdumez@apple.com>
916
917         Improve error handling in RegistrationDatabase
918         https://bugs.webkit.org/show_bug.cgi?id=180587
919
920         Reviewed by Brady Eidson.
921
922         * workers/service/server/RegistrationDatabase.cpp:
923         (WebCore::RegistrationDatabase::openSQLiteDatabase):
924         (WebCore::RegistrationDatabase::doPushChanges):
925
926 2017-12-07  Darin Adler  <darin@apple.com>
927
928         Simplify and streamline some Color-related code to prepare for some Color/ExtendedColor work
929         https://bugs.webkit.org/show_bug.cgi?id=180569
930
931         Reviewed by Sam Weinig.
932
933         * accessibility/AccessibilityNodeObject.cpp:
934         (WebCore::AccessibilityNodeObject::colorValue const): Use valueAsColor instead of
935         having custom code here to parse the color string.
936
937         * css/CSSGradientValue.cpp:
938         (WebCore::interpolate): Deleted.
939         (WebCore::CSSGradientValue::computeStops): Call blend instead of interpolate. The only
940         difference is that the interpolate function truncated when converting from floating point
941         to integer, and the blend function rounds instead.
942
943         * css/StyleResolver.cpp:
944         (WebCore::StyleResolver::colorFromPrimitiveValue const): Removed unneeded special case
945         for identifier of 0, since StyleColor::colorFromKeyword already handles that correctly.
946         Also got rid of unneded local variable "state".
947
948         * html/ColorInputType.cpp:
949         (WebCore::isValidSimpleColor): Rewrote to take a StringView instead of a String and
950         to stay with a single loop since this does not need the extra efficiency of a separate
951         8-bit and 16-bit character version. Renamed to more closely match what the specification
952         calls this algorithm.
953         (WebCore::parseSimpleColorValue): Added. To be used instead of relying on the behavior of
954         the Color constructor that takes a String, so we can remove that later.
955         (WebCore::ColorInputType::sanitizeValue const): Updated for name change.
956         (WebCore::ColorInputType::valueAsColor const): Use parseSimpleColorValue instead of the
957         Color constructor that takes a string.
958         (WebCore::ColorInputType::typeMismatchFor const): Updated for name change.
959         (WebCore::ColorInputType::selectColor): Updated to take a StringView instead of a Color.
960         Note that this function is used for testing only.
961
962         * html/ColorInputType.h: Marked everything final instead of override. Updated the
963         selectColor function to take a StringView instead of a Color.
964
965         * html/HTMLInputElement.cpp:
966         (WebCore::HTMLInputElement::selectColor): Take a StringView instead of a Color.
967         * html/HTMLInputElement.h: Ditto.
968
969         * html/InputType.cpp:
970         (WebCore::InputType::selectColor): Take a StringView instead of a Color.
971         * html/InputType.h: Ditto.
972
973         * testing/Internals.cpp:
974         (WebCore::Internals::selectColorInColorChooser): Pass the string directly instead of
975         constructing a Color with it.
976         (WebCore::Internals::setViewBaseBackgroundColor): Instead of pasring the passed in string
977         with the Color constructor, implemented the two names that are actually used with this
978         function in tests: "transparent" and "white".
979
980 2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
981
982         Unreviewed, fix wrong letter case in #import HTMLIframeElement.h
983
984         * editing/cocoa/WebContentReaderCocoa.mm:
985
986 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
987
988         Use WTF::RecursiveLockAdapter instead of using pthread_mutex_t with recursive lock option
989         https://bugs.webkit.org/show_bug.cgi?id=180449
990
991         Reviewed by Mark Lam.
992
993         Use WTF::RecursiveLockAdapter<StaticLock> instead. We can remove pthread_mutex_xxx,
994         pthread_once and FontLocker wrapper.
995
996         * platform/graphics/FontCache.cpp:
997         (WebCore::FontCache::getCachedFontPlatformData):
998         (WebCore::FontCache::fontForPlatformData):
999         (WebCore::FontCache::purgeInactiveFontData):
1000         (WebCore::FontCache::inactiveFontCount):
1001         (initFontCacheLockOnce): Deleted.
1002         (FontLocker::FontLocker): Deleted.
1003         (FontLocker::~FontLocker): Deleted.
1004
1005 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
1006
1007         Simplify log channel configuration UI
1008         https://bugs.webkit.org/show_bug.cgi?id=180527
1009         <rdar://problem/35908382>
1010
1011         Reviewed by Joseph Pecoraro.
1012
1013         No new tests, updated existing test.
1014
1015         * inspector/agents/WebConsoleAgent.cpp:
1016         (WebCore::WebConsoleAgent::getLoggingChannels):
1017         (WebCore::channelConfigurationForString):
1018
1019 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1020
1021         Use StaticLock instead of NeverDestroyed<Lock>
1022         https://bugs.webkit.org/show_bug.cgi?id=180507
1023
1024         Reviewed by Saam Barati.
1025
1026         StaticLock can be used instead of using NeverDestroyed<Lock>.
1027
1028         No behavior change.
1029
1030         * Modules/webdatabase/Database.cpp:
1031         (WebCore::Database::performOpenAndVerify):
1032         * Modules/webdatabase/DatabaseTracker.cpp:
1033         (WebCore::DatabaseTracker::openDatabaseMutex):
1034         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskWillBeScheduled):
1035         (WebCore::DatabaseTracker::emptyDatabaseFilesRemovalTaskDidFinish):
1036         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged):
1037         (WebCore::DatabaseTracker::scheduleForNotification):
1038         (WebCore::DatabaseTracker::notifyDatabasesChanged):
1039         (WebCore::notificationMutex): Deleted.
1040         * Modules/webdatabase/DatabaseTracker.h:
1041         * platform/URL.cpp:
1042         (WebCore::registerDefaultPortForProtocolForTesting):
1043         (WebCore::clearDefaultPortForProtocolMapForTesting):
1044         (WebCore::defaultPortForProtocol):
1045         (WebCore::defaultPortForProtocolMapForTestingLock): Deleted.
1046         * platform/graphics/MediaPlayer.cpp:
1047         (WebCore::buildMediaEnginesVector):
1048         (WebCore::installedMediaEngines):
1049         (WebCore::MediaPlayer::resetMediaEngines):
1050         (WebCore::mediaEngineVectorLock): Deleted.
1051         * platform/ios/QuickLook.mm:
1052         (WebCore::removeQLPreviewConverterForURL):
1053         (WebCore::addQLPreviewConverterWithFileForURL):
1054         (WebCore::qlPreviewConverterDictionaryMutex): Deleted.
1055         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
1056         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]):
1057         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]):
1058         (transactionBackgroundTaskIdentifierLock): Deleted.
1059         * platform/network/curl/CurlContext.cpp:
1060         (WebCore::CurlShareHandle::lockCallback):
1061         (WebCore::CurlShareHandle::unlockCallback):
1062         (WebCore::CurlShareHandle::mutexFor):
1063         * platform/network/curl/CurlContext.h:
1064
1065 2017-12-07  Brady Eidson  <beidson@apple.com>
1066
1067         Read registrations in from disk.
1068         https://bugs.webkit.org/show_bug.cgi?id=180543
1069
1070         Reviewed by Andy Estes.
1071
1072         No new tests (Not testable quite yet)
1073
1074         On launch, read through the database.
1075
1076         Set up enough objects in the SWServer necessary to cause fetches and postMessages to
1077         go to a worker that has never run before.
1078
1079         * workers/service/ServiceWorkerContextData.cpp:
1080         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1081         * workers/service/ServiceWorkerContextData.h:
1082         (WebCore::ServiceWorkerContextData::encode const):
1083         (WebCore::ServiceWorkerContextData::decode):
1084
1085         * workers/service/ServiceWorkerRegistrationKey.cpp:
1086         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
1087         (WebCore::ServiceWorkerRegistrationKey::fromDatabaseKey):
1088         * workers/service/ServiceWorkerRegistrationKey.h:
1089
1090         * workers/service/server/RegistrationDatabase.cpp:
1091         (WebCore::stringToUpdateViaCache):
1092         (WebCore::stringToWorkerType):
1093         (WebCore::RegistrationDatabase::doPushChanges):
1094         (WebCore::RegistrationDatabase::importRecords):
1095         (WebCore::RegistrationDatabase::addRegistrationToStore):
1096         * workers/service/server/RegistrationDatabase.h:
1097
1098         * workers/service/server/RegistrationStore.cpp:
1099         (WebCore::RegistrationStore::RegistrationStore):
1100         (WebCore::RegistrationStore::addRegistrationFromDatabase):
1101         * workers/service/server/RegistrationStore.h:
1102
1103         * workers/service/server/SWServer.cpp:
1104         (WebCore::SWServer::addRegistrationFromStore):
1105         (WebCore::SWServer::SWServer):
1106         (WebCore::SWServer::updateWorker):
1107         (WebCore::SWServer::tryInstallContextData):
1108         (WebCore::SWServer::installContextData):
1109         (WebCore::generateServiceWorkerIdentifier): Deleted.
1110         * workers/service/server/SWServer.h:
1111
1112         * workers/service/server/SWServerRegistration.h:
1113
1114         * workers/service/server/SWServerWorker.cpp:
1115         (WebCore::SWServerWorker::contextData const):
1116
1117 2017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
1118
1119         Use WTF Locking primitives in WebThread and drop pthread_xxx use
1120         https://bugs.webkit.org/show_bug.cgi?id=180445
1121
1122         Reviewed by Saam Barati.
1123
1124         We remove use of pthread locking primitives from WebThread implementation,
1125         and use WTF Lock and Condition instead.
1126
1127         No behavior change.
1128
1129         * platform/ios/wak/WebCoreThread.mm:
1130         (HandleDelegateSource):
1131         (SendDelegateMessage):
1132         (WebThreadRunOnMainThread):
1133         (WebThreadAdoptAndRelease):
1134         (WebCoreObjCDeallocOnWebThreadImpl):
1135         (WebCoreObjCDeallocWithWebThreadLockImpl):
1136         (HandleWebThreadReleaseSource):
1137         (_WebThreadAutoLock):
1138         (WebRunLoopLockInternal):
1139         (CurrentThreadContext):
1140         Use WTF::ThreadSpecific.
1141
1142         (StartWebThread):
1143         (_WebThreadLock):
1144         Remove `shouldTry` parameter since it is always `false`. We clean up code based on `shouldTry = false`,
1145         and rename it from _WebTryThreadLock to _WebThreadLock since it does not try now.
1146
1147         (_WebThreadLockFromAnyThread):
1148         (WebThreadUnlockFromAnyThread):
1149         (_WebThreadUnlock):
1150         (lockWebCoreReleaseLock): Deleted.
1151         (unlockWebCoreReleaseLock): Deleted.
1152         (WebTimedConditionLock): Deleted.
1153         (_WebTryThreadLock): Deleted.
1154
1155 2017-12-07  Alex Christensen  <achristensen@webkit.org>
1156
1157         Fix API test after r225645.
1158         https://bugs.webkit.org/show_bug.cgi?id=180544
1159
1160         * loader/FrameLoader.cpp:
1161         (WebCore::FrameLoader::loadURL):
1162         (WebCore::FrameLoader::loadWithDocumentLoader):
1163         The API test WebKitLegacy.FragmentNavigation started failing after r225645.
1164         It does call the completion handler with ignore to cancel fragment navigation.
1165         To make this work and increase compatibility, only synchronously continue with
1166         fragment navigations if we haven't received a synchronous answer to the
1167         decidePolicyForNavigationAction callback.
1168
1169 2017-12-07  Oleksandr Skachkov  <gskachkov@gmail.com>
1170
1171         WebAssembly: sending module to iframe fails
1172         https://bugs.webkit.org/show_bug.cgi?id=179263
1173
1174         Reviewed by JF Bastien.
1175
1176         Allow use WebAssembly.Module as input parameters for postMessage 
1177         in window and iframe object.
1178
1179         Tests: wasm/iframe-postmessage.html
1180                wasm/window-postmessage.html
1181
1182         * bindings/js/SerializedScriptValue.cpp:
1183         (WebCore::CloneSerializer::dumpIfTerminal):
1184         * bindings/js/SerializedScriptValue.h:
1185         * page/DOMWindow.cpp:
1186         (WebCore::DOMWindow::postMessage):
1187
1188 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
1189
1190         Web Inspector: Fix style in remote inspector classes
1191         https://bugs.webkit.org/show_bug.cgi?id=180545
1192
1193         Reviewed by Youenn Fablet.
1194
1195         * page/PageDebuggable.h:
1196         * workers/service/context/ServiceWorkerDebuggable.h:
1197
1198 2017-12-07  Antti Koivisto  <antti@apple.com>
1199
1200         Move security origin filtering for getMatchedCSSRules out of StyleResolver
1201         https://bugs.webkit.org/show_bug.cgi?id=180468
1202
1203         Reviewed by Zalan Bujtas.
1204
1205         The non-standard getMatchedCSSRules API should not return rules from stylesheets in different security origins.
1206         To implement this we currently have lots of invasive code in StyleResolver, RuleSets and ElementRuleCollector
1207         basically passing around a bit. This also makes RuleSets document specific blocking optimizations.
1208
1209         This patches replaces the mechanism with a bit in StyleRule which is much simpler.
1210
1211         * css/DocumentRuleSets.cpp:
1212         (WebCore::makeRuleSet):
1213         * css/ElementRuleCollector.cpp:
1214         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
1215         * css/ElementRuleCollector.h:
1216         (WebCore::ElementRuleCollector::setPseudoStyleRequest):
1217         (WebCore::ElementRuleCollector::setSameOriginOnly): Deleted.
1218         * css/RuleFeature.cpp:
1219         (WebCore::RuleFeatureSet::collectFeatures):
1220         * css/RuleFeature.h:
1221         (WebCore::RuleFeature::RuleFeature):
1222         * css/RuleSet.cpp:
1223         (WebCore::RuleData::RuleData):
1224         (WebCore::RuleSet::addRule):
1225         (WebCore::RuleSet::addChildRules):
1226         (WebCore::RuleSet::addRulesFromSheet):
1227         (WebCore::RuleSet::addStyleRule):
1228         * css/RuleSet.h:
1229         (WebCore::RuleData::linkMatchType const):
1230         (WebCore::RuleData::hasDocumentSecurityOrigin const): Deleted.
1231         * css/StyleResolver.cpp:
1232         (WebCore::StyleResolver::pseudoStyleRulesForElement):
1233         * css/StyleResolver.h:
1234         * css/StyleRule.cpp:
1235         (WebCore::StyleRule::StyleRule):
1236         (WebCore::StyleRule::createForSplitting):
1237         (WebCore::StyleRule::splitIntoMultipleRulesWithMaximumSelectorComponentCount const):
1238         (WebCore::StyleRule::create): Deleted.
1239         * css/StyleRule.h:
1240         (WebCore::StyleRuleBase::StyleRuleBase):
1241         (WebCore::StyleRuleBase::hasDocumentSecurityOrigin const):
1242
1243             Add a bit.
1244
1245         * css/parser/CSSParser.cpp:
1246         (WebCore::CSSParserContext::CSSParserContext):
1247
1248             Include hasDocumentSecurityOrigin bit to parser context. This means that a stylesheet data structures
1249             can't be shared between a contexts where this differs. This likely very rare in practice.
1250
1251         (WebCore::operator==):
1252         * css/parser/CSSParserImpl.cpp:
1253         (WebCore::CSSParserImpl::consumeStyleRule):
1254         * css/parser/CSSParserMode.h:
1255         (WebCore::CSSParserContextHash::hash):
1256         * editing/EditingStyle.cpp:
1257         (WebCore::EditingStyle::mergeStyleFromRules):
1258         * page/DOMWindow.cpp:
1259         (WebCore::DOMWindow::getMatchedCSSRules const):
1260
1261             Filter out rules from different security origin after getting them from style resolver.
1262
1263 2017-12-07  Zalan Bujtas  <zalan@apple.com>
1264
1265         AX: Document::existingAXObjectCache() should always return the existing AXObjectCache.
1266         https://bugs.webkit.org/show_bug.cgi?id=180548
1267         <rdar://problem/35917755>
1268
1269         Reviewed by Chris Fleizach.
1270
1271         Currently the AX cache becomes unreachable through Document::existingAXObjectCache soon after the render tree is destroyed.
1272         From this point, the Node objects can't deregister themselves from the AX cache anymore. In some cases, it's
1273         redundant/not advised to notify the cache about certain changes when the document is being destroyed, but the
1274         callsites should make that decision.
1275
1276         Covered by existing tests.
1277
1278         * dom/Document.cpp:
1279         (WebCore::Document::existingAXObjectCacheSlow const):
1280         * rendering/RenderElement.cpp:
1281         (WebCore::RenderElement::takeChildInternal):
1282
1283 2017-12-07  Youenn Fablet  <youenn@apple.com>
1284
1285         Fix erroneous ASSERT in DocumentThreadableLoader::didFail
1286         https://bugs.webkit.org/show_bug.cgi?id=180549
1287
1288         Reviewed by Alex Christensen.
1289
1290         * loader/DocumentThreadableLoader.cpp:
1291         (WebCore::DocumentThreadableLoader::didFail): ASSERT was checking whether the optional was null.
1292         This could never be the case since we move the value of the optional, not the optional itself.
1293         Ensure that the optional value is null so that we are sure request is being loaded and make the optional null just after that.
1294
1295 2017-12-07  Ryosuke Niwa  <rniwa@webkit.org>
1296
1297         iOS: Many AMP pages crash inside Document::updateStyleIfNeeded
1298         https://bugs.webkit.org/show_bug.cgi?id=180550
1299         <rdar://problem/35410390>
1300
1301         Reviewed by Zalan Bujtas.
1302
1303         The crash was caused when updatign the layout of an non-flattened frame inside a flattened frame.
1304         In those cases, isInChildFrameWithFrameFlattening is false on the inner frame.
1305
1306         No new tests for now.
1307
1308         * dom/NoEventDispatchAssertion.h:
1309         * rendering/RenderFrameBase.cpp:
1310         (WebCore::RenderFrameBase::performLayoutWithFlattening): Disable the assertion temporarily here.
1311         In theory, we should be able to remove the check for isInChildFrameWithFrameFlattening but we err
1312         on the safer side for now.
1313
1314 2017-12-07  Alex Christensen  <achristensen@webkit.org>
1315
1316         Always synchronously continue with fragment navigations
1317         https://bugs.webkit.org/show_bug.cgi?id=180544
1318         <rdar://problem/34815986> and <rdar://problem/35126690>
1319
1320         Reviewed by Geoffrey Garen.
1321
1322         Test: http/tests/dom/document-fragment.html
1323
1324         When a decidePolicyForNavigationAction completionHandler is called asynchronously,
1325         the document's URL has not changed yet when JavaScript execution continues.  This causes
1326         significant web incompatibility because all browsers change the document's URL immediately
1327         during fragment navigations.  In order to make WebKit applications more web compatible,
1328         we now immediately continue to have the state consistent.  To keep compatibility with any
1329         WebView, UIWebView, or WKWebView applications that use these delegate callbacks to update
1330         state, we still call decidePolicyForNavigationAction.  This would break a theoretical app
1331         that would cancel fragment navigations, but it fixes apps that continue fragment navigations
1332         asynchronously.
1333
1334         * loader/FrameLoader.cpp:
1335         (WebCore::FrameLoader::loadURL):
1336         (WebCore::FrameLoader::loadWithDocumentLoader):
1337
1338 2017-12-07  Youenn Fablet  <youenn@apple.com>
1339
1340         Activate IDB and WebSockets in service workers
1341         https://bugs.webkit.org/show_bug.cgi?id=180534
1342
1343         Reviewed by Brady Eidson.
1344
1345         Tests: http/tests/workers/service/serviceworker-idb.https.html
1346                http/tests/workers/service/serviceworker-websocket.https.html
1347
1348         Using the dummy document used for loading to also fuel IDB and WebSocket.
1349
1350         * workers/service/context/ServiceWorkerThread.cpp:
1351         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1352         * workers/service/context/ServiceWorkerThread.h:
1353         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1354         (WebCore::idbConnectionProxy):
1355         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1356
1357 2017-12-07  Matt Lewis  <jlewis3@apple.com>
1358
1359         Unreviewed, rolling out r225634.
1360
1361         This caused layout tests to time out.
1362
1363         Reverted changeset:
1364
1365         "Simplify log channel configuration UI"
1366         https://bugs.webkit.org/show_bug.cgi?id=180527
1367         https://trac.webkit.org/changeset/225634
1368
1369 2017-12-07  Jer Noble  <jer.noble@apple.com>
1370
1371         [EME] Support the 'encrypted' event for FPS encrypted streams
1372         https://bugs.webkit.org/show_bug.cgi?id=180480
1373
1374         Reviewed by Eric Carlson.
1375
1376         Test: platform/mac/media/encrypted-media/fps-encrypted-event.html
1377
1378         Pass initData and initDataType up to HTMLMediaElement from SourceBufferPrivateAVFObjC.
1379
1380         Drive-by fix: initialize the initData and initDataType values of MediaEncryptedEvent from
1381         values in its initializer struct.
1382
1383         * html/HTMLMediaElement.cpp:
1384         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
1385         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
1386         * html/MediaEncryptedEvent.cpp:
1387         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
1388         (WebCore::MediaEncryptedEvent::initDataType): Deleted.
1389         (WebCore::MediaEncryptedEvent::initData): Deleted.
1390         * html/MediaEncryptedEvent.h:
1391         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1392         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1393         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
1394         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1395         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
1396
1397 2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
1398
1399         [Cocoa] Add SPI to disallow user-installed fonts
1400         https://bugs.webkit.org/show_bug.cgi?id=180062
1401         <rdar://problem/35042408>
1402
1403         Reviewed by Simon Fraser.
1404
1405         This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
1406         code. This preference works by specifying an attribute to our font selection code which
1407         will prohibit user-installed fonts from ever being selected. This works both to disallow
1408         newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
1409         have the same name as) existing fonts, so that the existing font is selected instead.
1410
1411         The goal of this setting is to decrease the fingerprinting surface area which trackers
1412         can use to identify users on the open Web.
1413
1414         Tests: fast/text/user-installed-font.html
1415                fast/text/user-installed-fonts/disable.html
1416                fast/text/user-installed-fonts/shadow-disable.html
1417                fast/text/user-installed-fonts/shadow-family-disable.html
1418                fast/text/user-installed-fonts/shadow-family.html
1419                fast/text/user-installed-fonts/shadow-postscript-disable.html
1420                fast/text/user-installed-fonts/shadow-postscript-family-disable.html
1421                fast/text/user-installed-fonts/shadow-postscript-family.html
1422                fast/text/user-installed-fonts/shadow-postscript.html
1423                fast/text/user-installed-fonts/shadow.html
1424
1425         * css/CSSFontFaceSet.cpp:
1426         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1427         * css/StyleResolver.cpp:
1428         (WebCore::StyleResolver::initializeFontStyle):
1429         * page/Settings.yaml:
1430         * platform/graphics/FontCache.h:
1431         * platform/graphics/FontDescription.cpp:
1432         (WebCore::FontDescription::FontDescription):
1433         * platform/graphics/FontDescription.h:
1434         (WebCore::FontDescription::mayRepresentUserInstalledFont const):
1435         (WebCore::FontDescription::setMayRepresentUserInstalledFont):
1436         (WebCore::FontDescription::operator== const):
1437         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1438         (WebCore::FontDatabase::singleton):
1439         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
1440         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
1441         (WebCore::FontDatabase::collectionForFamily):
1442         (WebCore::FontDatabase::fontForPostScriptName):
1443         (WebCore::FontDatabase::FontDatabase):
1444         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
1445         (WebCore::platformFontLookupWithFamily):
1446         (WebCore::invalidateFontCache):
1447         (WebCore::fontWithFamily):
1448         * style/StyleResolveForDocument.cpp:
1449         (WebCore::Style::resolveForDocument):
1450         * testing/InternalSettings.cpp:
1451         (WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
1452         * testing/InternalSettings.h:
1453         * testing/InternalSettings.idl:
1454
1455 2017-12-07  David Quesada  <david_quesada@apple.com>
1456
1457         [Web App Manifest] Support display-mode media feature
1458         https://bugs.webkit.org/show_bug.cgi?id=180376
1459         rdar://problem/35837993
1460
1461         Reviewed by Geoffrey Garen.
1462
1463         Tests: applicationmanifest/display-mode-subframe.html
1464                applicationmanifest/display-mode.html
1465
1466         * Modules/applicationmanifest/ApplicationManifest.h:
1467         (WebCore::ApplicationManifest::encode const):
1468         (WebCore::ApplicationManifest::decode):
1469         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
1470         (WebCore::ApplicationManifestParser::parseManifest):
1471         (WebCore::ApplicationManifestParser::parseDisplay):
1472         * Modules/applicationmanifest/ApplicationManifestParser.h:
1473             Add a 'display' property to ApplicationManifest and have ApplicationManifestParser
1474             populate it by parsing the 'display' property from the raw manifest.
1475
1476         * css/CSSValueKeywords.in:
1477         * css/MediaFeatureNames.h:
1478         * css/MediaQueryEvaluator.cpp:
1479         (WebCore::displayModeEvaluate):
1480             To evaluate whether a display-mode query matches, compare the parameter to the
1481             display mode of the manifest applied to the main frame. If there is no manifest,
1482             use the fallback display mode 'browser' - the spec mandates that display-mode
1483             must be exposed even if there is no applied manifest.
1484         * css/MediaQueryExpression.cpp:
1485         (WebCore::featureWithValidIdent):
1486         (WebCore::isFeatureValidWithoutValue):
1487
1488 2017-12-07  Jer Noble  <jer.noble@apple.com>
1489
1490         Creating a second AVPlayerItemVideoOutput causes flakey failures
1491         https://bugs.webkit.org/show_bug.cgi?id=177119
1492         <rdar://problem/34507977>
1493
1494         Reviewed by Dean Jackson.
1495
1496         Rather than having two concurrent AVPlayerItemVideoOutputs when painting to OpenGL,
1497         use only one, but with the OpenGL compatibility flags enabled, for both 3D and 2D
1498         canvas painting.
1499
1500         Of course, once this is fixed, the test breaks again because VideoTextureCopierCV is
1501         stomping on top of some WebGL state set by the test. Rather than expand the
1502         VideoTextureCopierCV's GraphicsStateSaver, use a totally separate (but shared) GL context to
1503         implement the texture copy, so that its own state will not affect the state of the WebGL
1504         context.
1505
1506         This necessitates adding a new createShared() factory for GraphicsContext3D. Since this is only
1507         used on Cocoa platforms (for now), make it platform specific, and modify the other implementations
1508         only so far as to throw assertions if somehow a shared context pointer is passed into their
1509         constructors.
1510
1511         Drive-by fixes: 
1512
1513         - These changes exposed some test failures, which were off-by-1-or-2 errors in the color
1514         output of videos painted into WebGL contexts. The Y' parameter needs to be scaled by 16/255
1515         for video-range conversions and the CbCr vales by 128/255 (rather than just 0.5). Make the
1516         color transforms a full 4x4 matrix and do the scaling in the matrix rather than tracked by a
1517         separate uniform.
1518
1519         - There was a slight error in WebCoreDecompressionSession that could cause seeks to never
1520         complete because incoming frames would be skipped if their startTime was in the past
1521         (rather than their startTime + duration being in the past).
1522
1523         - The matrix name comparison should use CFEqual rather than pointer equality to test.
1524
1525         - iOS currently has a bug where the red and green color channels will be reversed when
1526         uploading BGRA pixel formatted data to a texture; work around this bug for now.
1527
1528         * platform/graphics/GraphicsContext3D.h:
1529         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1530         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1531         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyContextVideoRenderer):
1532         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
1533         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastPixelBuffer):
1534         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoOutputHasAvailableFrame):
1535         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
1536         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
1537         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture):
1538         (WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
1539         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
1540         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1541         (WebCore::GraphicsContext3D::GraphicsContext3D):
1542         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1543         (WebCore::GraphicsContext3D::createShared):
1544         (WebCore::GraphicsContext3D::GraphicsContext3D):
1545         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1546         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV):
1547         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV):
1548         (WebCore::transferFunctionFromString):
1549         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1550         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
1551         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1552         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
1553         * platform/graphics/cv/VideoTextureCopierCV.h:
1554         (WebCore::VideoTextureCopierCV::context):
1555         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1556         (WebCore::GraphicsContext3D::GraphicsContext3D):
1557
1558 2017-12-07  Jer Noble  <jer.noble@apple.com>
1559
1560         [EME] Support generateRequest() in CDMFairPlayStreaming
1561         https://bugs.webkit.org/show_bug.cgi?id=179752
1562
1563         Reviewed by Eric Carlson.
1564
1565         Tests: platform/mac/media/encrypted-media/fps-createSession.html
1566                platform/mac/media/encrypted-media/fps-generateRequest.html
1567
1568         Add support for generating license requests from initialization data in
1569         CDMFairPlayStreaming. To do so, add explicit checks for FairPlay Steraming requirements:
1570         reqests will fail if no server certificate exists, and will fail if no content key id exists
1571         in the initialization data.
1572
1573         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
1574         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf):
1575         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSinf):
1576         (WebCore::CDMFactory::platformRegisterFactories):
1577         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
1578         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1579         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
1580         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
1581
1582 2017-12-07  Jer Noble  <jer.noble@apple.com>
1583
1584         [EME] Possible deadlock when aborting a SourceBufferPrivateAVFObjC append operation
1585         https://bugs.webkit.org/show_bug.cgi?id=180486
1586
1587         Reviewed by Eric Carlson.
1588
1589         It's possible that an abort() operation which is blocked on the ongoing appendBuffer()
1590         operation completing will deadlock forever, with either the willProvideContentKeyRequest
1591         or didProvideContentKeyRequest callbacks blocking waiting to be run on the main thread
1592         (which is itself blocked waiting for the append operation to complete).
1593
1594         To break this deadlock, add a new abortSemaphore which is signaled in the abort() method
1595         and have the willProvide... and didProvide... methods block both on their own semaphores
1596         as well as the abortSemaphore, allowing them to break out even if their main thread calls
1597         never get a chance to execute.
1598
1599         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1600         (-[WebAVStreamDataParserListener streamDataParserWillProvideContentKeyRequestInitializationData:forTrackID:]):
1601         (-[WebAVStreamDataParserListener streamDataParser:didProvideContentKeyRequestInitializationData:forTrackID:]):
1602         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1603         (WebCore::SourceBufferPrivateAVFObjC::abort):
1604
1605 2017-12-07  Eric Carlson  <eric.carlson@apple.com>
1606
1607         Simplify log channel configuration UI
1608         https://bugs.webkit.org/show_bug.cgi?id=180527
1609         <rdar://problem/35908382>
1610
1611         Reviewed by Joseph Pecoraro.
1612
1613         No new tests -- no change in functionality.
1614
1615         * inspector/agents/WebConsoleAgent.cpp:
1616         (WebCore::WebConsoleAgent::getLoggingChannels):
1617         (WebCore::channelConfigurationForString):
1618
1619 2017-12-07  Joseph Pecoraro  <pecoraro@apple.com>
1620
1621         ServiceWorker Inspector: Use the SW's scope url for the remote inspection target metadata
1622         https://bugs.webkit.org/show_bug.cgi?id=180519
1623
1624         Reviewed by Youenn Fablet.
1625
1626         * workers/service/context/ServiceWorkerDebuggable.cpp:
1627         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
1628         * workers/service/context/ServiceWorkerDebuggable.h:
1629         Switch to the scope URL for the remote inspector target info.
1630
1631 2017-12-07  Per Arne Vollan  <pvollan@apple.com>
1632
1633         Unreviewed Windows build fix.
1634
1635         * PlatformWin.cmake:
1636
1637 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1638
1639         [WPE][GTK] Freeze WebKit version in user agent
1640         https://bugs.webkit.org/show_bug.cgi?id=180475
1641
1642         Reviewed by Carlos Garcia Campos.
1643
1644         Apple has frozen the WebKit version in its user agent, so we should too, at the same point.
1645
1646         * platform/glib/UserAgentGLib.cpp:
1647         (WebCore::versionForUAString):
1648
1649 2017-12-07  Michael Catanzaro  <mcatanzaro@igalia.com>
1650
1651         [WPE][GTK] Update user agent quirk version strings
1652         https://bugs.webkit.org/show_bug.cgi?id=180474
1653
1654         Reviewed by Carlos Garcia Campos.
1655
1656         * platform/UserAgentQuirks.cpp:
1657         (WebCore::UserAgentQuirks::stringForQuirk):
1658         * platform/glib/UserAgentGLib.cpp:
1659         (WebCore::platformVersionForUAString):
1660
1661 2017-12-06  Chris Dumez  <cdumez@apple.com>
1662
1663         We should be able to recover after a Service Worker process crash
1664         https://bugs.webkit.org/show_bug.cgi?id=180477
1665
1666         Reviewed by Brady Eidson and Youenn Fablet.
1667
1668         Test: http/tests/workers/service/postmessage-after-sw-process-crash.https.html
1669
1670         * workers/service/server/SWServer.cpp:
1671         (WebCore::SWServer::serverToContextConnectionCreated):
1672         Once the connection with the context process is established, process "run service worker"
1673         requests that ocurred while establishing the connection.
1674
1675         (WebCore::SWServer::runServiceWorkerIfNecessary):
1676         Take in a lambda function that gets called after the "run service worker" request
1677         is processed. We used to assert that we had a connection to the context process.
1678         We now wait for the connection to be established to process the request, thus
1679         making the operation asynchronous.
1680
1681         (WebCore::SWServer::runServiceWorker):
1682         Split some logic out of runServiceWorkerIfNecessary() to reuse in serverToContextConnectionCreated().
1683
1684         (WebCore::SWServer::markAllWorkersAsTerminated):
1685         Add method to mark all service workers as terminated. This is called when the Service
1686         Worker process crashes.
1687
1688         * workers/service/server/SWServer.h:
1689
1690 2017-12-06  Saam Barati  <sbarati@apple.com>
1691
1692         Unreviewed. Fix iOS (and maybe other platform) build
1693
1694         * workers/service/server/RegistrationDatabase.cpp:
1695         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1696
1697 2017-12-02  Darin Adler  <darin@apple.com>
1698
1699         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
1700         https://bugs.webkit.org/show_bug.cgi?id=180009
1701
1702         Reviewed by Alex Christensen.
1703
1704         * Modules/fetch/FetchBody.cpp:
1705         (WebCore::FetchBody::consumeAsStream): Update to use size since the result of
1706         encode is now Vector rather than CString. And for the new UnencodableHandling.
1707         (WebCore::FetchBody::consumeText): Removed now-unneeded type cast. Ditto.
1708         (WebCore::FetchBody::bodyAsFormData const): Ditto.
1709         (WebCore::FetchBody::take): Pass result of encode directly to SharedBuffer::create.
1710
1711         * Modules/websockets/WebSocketDeflater.cpp: Removed include of StringExtras.h.
1712         * bridge/IdentifierRep.h: Ditto.
1713         * bridge/c/c_instance.cpp: Ditto.
1714
1715         * fileapi/BlobBuilder.cpp:
1716         (WebCore::BlobBuilder::append): Updated for CString to Vector change and
1717         for UnencodableHandling.
1718
1719         * html/parser/HTMLMetaCharsetParser.cpp:
1720         (WebCore::HTMLMetaCharsetParser::checkForMetaCharset): Call the decode function
1721         with all the arguments since there is only one decode function now.
1722
1723         * inspector/agents/InspectorDOMAgent.cpp:
1724         (WebCore::computeContentSecurityPolicySHA256Hash): Updated for CString to Vector
1725         change and for UnencodableHandling.
1726
1727         * loader/ResourceCryptographicDigest.cpp:
1728         (WebCore::cryptographicDigestForBytes): Changed argument type to const void*.
1729         * loader/ResourceCryptographicDigest.h: Ditto.
1730
1731         * loader/TextResourceDecoder.cpp:
1732         (WebCore::TextResourceDecoder::TextResourceDecoder): Moved initialization of data
1733         members to class definition.
1734         (WebCore::TextResourceDecoder::create): Moved function body here from the header.
1735         (WebCore::TextResourceDecoder::setEncoding): Use equalLettersIgnoringASCIICase.
1736         (WebCore::TextResourceDecoder::shouldAutoDetect const): Updated for name change
1737         to m_parentFrameAutoDetectedEncoding, which obviates a comment.
1738         (WebCore::TextResourceDecoder::flush): Ditto.
1739         * loader/TextResourceDecoder.h: Moved initialization here from constructor.
1740         Moved function bodies out of the class. Renamed m_hintEncoding to
1741         m_parentFrameAutoDetectedEncoding since that is a more accurate description.
1742
1743         * loader/appcache/ApplicationCacheStorage.cpp: Removed include of StringExtras.h.
1744         * page/FrameTree.cpp: Ditto.
1745         * page/PageSerializer.cpp: Ditto.
1746         (WebCore::PageSerializer::serializeFrame): Pass result of encode directly to
1747         StringBuffer::create and update for UnencodableHandling.
1748         (WebCore::PageSerializer::serializeCSSStyleSheet): Ditto.
1749         * page/csp/ContentSecurityPolicy.cpp:
1750         (WebCore::ContentSecurityPolicy::findHashOfContentInPolicies const): Ditto.
1751
1752         * platform/FileHandle.cpp: Removed include of StringExtras.h.
1753
1754         * platform/SharedBuffer.cpp:
1755         (WebCore::SharedBuffer::create): Added an overload that takes Vector<uint8_t>.
1756         * platform/SharedBuffer.h: Ditto.
1757
1758         * platform/URLParser.cpp:
1759         (WebCore::URLParser::encodeQuery): Updated since encode returns a Vector instead
1760         of a CString now and for UnencodableHandling.
1761         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1762         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Ditto.
1763
1764         * platform/graphics/ca/PlatformCALayer.cpp: Removed include of StringExtras.h.
1765
1766         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1767         (WebCore::ResourceHandleCurlDelegate::handleDataURL): Updated for Vector instead
1768         of CString.
1769
1770         * platform/network/FormData.cpp:
1771         (WebCore::FormData::create): Added new overload, and simplified some existing ones.
1772         (WebCore::normalizeStringData): Changed return type to Vector<uint8_t> and updated
1773         for UnencodableHandling.
1774         (WebCore::FormData::appendMultiPartStringValue): Updated for change in type of
1775         result of normalizeStringData.
1776         * platform/network/FormData.h: Updated for the above and updated comments.
1777
1778         * platform/network/FormDataBuilder.cpp: Made this a namespace instead of a class.
1779         (WebCore::FormDataBuilder::append): Added an overload for Vector<uint8_t>.
1780         (WebCore::FormDataBuilder::appendQuoted): Renamed from appendQuotedString and
1781         changed the argument type.
1782         (WebCore::FormDataBuilder::appendFormURLEncoded): Moved logic up from the
1783         encodeStringAsFormData function into a new separate helper.
1784         (WebCore::FormDataBuilder::addFilenameToMultiPartHeader): Updated for change to
1785         UnencodableHandling.
1786         (WebCore::FormDataBuilder::beginMultiPartHeader): Changed argument type.
1787         (WebCore::FormDataBuilder::addKeyValuePairAsFormData): Ditto.
1788         (WebCore::FormDataBuilder::encodeStringAsFormData): Updated to call helper.
1789         * platform/network/FormDataBuilder.h: Updated for the above.
1790
1791         * platform/text/DecodeEscapeSequences.h: Use Vector<uint8_t> instead of
1792         Vector<char>, also updated the code that calls encode for the new return type
1793         and updated for change to UnencodableHandler.
1794
1795         * platform/text/TextCodec.cpp:
1796         (WebCore::TextCodec::getUnencodableReplacement): Updated since we are using
1797         std::array now, so the out argument is easier to understand, also updated for
1798         change to UnencodablaHandler.
1799         * platform/text/TextCodec.h: Use std::array for the UnencodableReplacementArray
1800         type, removed the overload of decode so there is only one decode function.
1801
1802         * platform/text/TextCodecICU.cpp:
1803         (WebCore::ICUConverterWrapper::~ICUConverterWrapper): Deleted.
1804         Not needed any more since we use ICUConverterPtr instead now.
1805         (WebCore::cachedConverterICU): Deleted.
1806         (WebCore::TextCodecICU::create): Deleted. Callers just use make_unique
1807         directly now.
1808         (WebCore::TextCodecICU::registerCodecs): Rewrote to use lambdas instead
1809         of functions with void* pointers.
1810         (WebCore::TextCodecICU::TextCodecICU): Moved initializers into the header.
1811         (WebCore::TextCodecICU::~TextCodecICU): Moved the body of releaseICUConverter
1812         in here. Also greatly simplified it now that ICUConverterPtr handles closing
1813         it as needed.
1814         (WebCore::TextCodecICU::releaseICUConverter const): Deleted.
1815         (WebCore::TextCodecICU::createICUConverter const): Rewrote to simplfy now that
1816         we can use ICUConverterPtr.
1817         (WebCore::ErrorCallbackSetter::ErrorCallbackSetter): Take a reference instead
1818         of a pointer.
1819         (WebCore::ErrorCallbackSetter::~ErrorCallbackSetter): Ditto.
1820         (WebCore::TextCodecICU::decode): Use equalLettersIgnoringASCIICase instead of
1821         strcasecmp.
1822         (WebCore::TextCodecICU::encode): Return a Vector instead of a CString.
1823         Take a StringView instead of a pointer and length. Simplified
1824         the backslash-as-currency-symbol code by using String::replace.
1825         * platform/text/TextCodecICU.h: Updated for above. Fixed indentation.
1826         Added a new ICUConverterPtr typedef that uses std::unique_ptr to close the
1827         converter; combined with move semantics it simplifies things so we don't have
1828         to be so careful about calling ucnv_close.
1829
1830         * platform/text/TextCodecLatin1.cpp: Renamed the Latin-1 to Unicode table from
1831         "table" to latin1ConversionTable.
1832         (WebCore::TextCodecLatin1::registerCodecs): Use a lambda.
1833         (WebCore::encodeComplexWindowsLatin1): Return a Vector instad of CString.
1834         Also use StringView::codePoints instead of our own U16_NEXT.
1835         (WebCore::TextCodecLatin1::encode): More of the same.
1836         * platform/text/TextCodecLatin1.h: Updated for the above.
1837
1838         * platform/text/TextCodecReplacement.cpp:
1839         (WebCore::TextCodecReplacement::create): Deleted.
1840         (WebCore::TextCodecReplacement::TextCodecReplacement): Deleted.
1841         (WebCore::TextCodecReplacement::registerCodecs): Use a lambda.
1842         * platform/text/TextCodecReplacement.h: Updated for the above.
1843
1844         * platform/text/TextCodecUTF16.cpp:
1845         (WebCore::newStreamingTextDecoderUTF16LE): Deleted.
1846         (WebCore::newStreamingTextDecoderUTF16BE): Deleted.
1847         (WebCore::TextCodecUTF16::registerCodecs): Use lambdas.
1848         (WebCore::TextCodecUTF16::encode): Return a Vector.
1849         * platform/text/TextCodecUTF16.h: Updated for the above.
1850
1851         * platform/text/TextCodecUTF8.cpp:
1852         (WebCore::TextCodecUTF8::registerCodecs): Use a lambda.
1853         (WebCore::TextCodecUTF8::encode): Return a Vector.
1854         * platform/text/TextCodecUTF8.h: Updated for the above.
1855
1856         * platform/text/TextCodecUserDefined.cpp:
1857         (WebCore::newStreamingTextDecoderUserDefined): Deleted.
1858         (WebCore::TextCodecUserDefined::registerCodecs): Use a lambda.
1859         (WebCore::encodeComplexUserDefined): Return a Vector.
1860         (WebCore::TextCodecUserDefined::encode): Ditto.
1861         * platform/text/TextCodecUserDefined.h: Updated for the above.
1862
1863         * platform/text/TextEncoding.cpp: Changed TextCodecMap to just hold a
1864         WTF::Function instead of holding a function and an additional data pointer.
1865         (WebCore::TextEncoding::TextEncoding): Use equalLettersIgnoringASCIICase
1866         instead of a special isReplacementEncoding function.
1867         (WebCore::TextEncoding::encode const): Return a Vector instead of a CString.
1868         Pass StringView instead of a pointer and length.
1869         * platform/text/TextEncoding.h: Updated for the above.
1870
1871         * platform/text/TextEncodingRegistry.cpp:
1872         (WebCore::addToTextCodecMap): Removed the additionalData pointer and used
1873         WTFMove since NewTextCodecFunction is now a WTF::Function rather than a C
1874         function pointer.
1875         (WebCore::isReplacementEncoding): Deleted.
1876         (WebCore::newTextCodec): Use find instead of get now that the fucntions in
1877         the map are WTF::Function and can't be copied.
1878         (WebCore::dumpTextEncodingNameMap): Deleted.
1879         * platform/text/TextEncodingRegistry.h: Updated for the above.
1880
1881         * platform/text/win/TextCodecWin.cpp:
1882         (WebCore::TextCodecWin::encode): Updated comment.
1883
1884         * xml/XMLHttpRequest.cpp:
1885         (WebCore::XMLHttpRequest::send): Updated for change to UnencodableHandling.
1886
1887         * xml/XSLTUnicodeSort.cpp: Removed include of StringExtras.h.
1888         * xml/parser/XMLDocumentParser.cpp: Ditto.
1889         * xml/parser/XMLDocumentParserLibxml2.cpp: Ditto.
1890
1891 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
1892
1893         Support the decoding="sync/async" syntax for image async attribute
1894         https://bugs.webkit.org/show_bug.cgi?id=179432
1895
1896         Reviewed by Darin Adler.
1897
1898         Support the HTMLElementImage decoding attribute to allow controlling the
1899         decoding of an image as per:
1900                 https://github.com/whatwg/html/pull/3221
1901                 https://whatpr.org/html/3221/images.html#decoding-images
1902
1903         Tests: fast/images/decode-decoding-attribute-async-large-image.html
1904                fast/images/decoding-attribute-async-small-image.html
1905                fast/images/decoding-attribute-dynamic-async-small-image.html
1906                fast/images/decoding-attribute-sync-large-image.html
1907
1908         * html/HTMLAttributeNames.in:
1909         * html/HTMLImageElement.cpp:
1910         (WebCore::HTMLImageElement::decodingMode const):
1911         * html/HTMLImageElement.h:
1912         * html/HTMLImageElement.idl:
1913         * platform/graphics/BitmapImage.cpp:
1914         (WebCore::BitmapImage::draw):
1915         (WebCore::BitmapImage::internalStartAnimation):
1916         (WebCore::BitmapImage::advanceAnimation):
1917         (WebCore::BitmapImage::internalAdvanceAnimation):
1918         * platform/graphics/DecodingOptions.h:
1919         (WebCore::DecodingOptions::DecodingOptions):
1920         (WebCore::DecodingOptions::isAuto const):
1921         (WebCore::DecodingOptions::isAsynchronousCompatibleWith const):
1922         (WebCore::DecodingOptions::isNone const): Deleted.
1923         * platform/graphics/ImageDecoder.h:
1924         * platform/graphics/ImageFrame.cpp:
1925         (WebCore::ImageFrame::clearImage):
1926         * platform/graphics/ImageSource.cpp:
1927         (WebCore::ImageSource::frameAtIndexCacheIfNeeded):
1928         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1929         * platform/graphics/cg/ImageDecoderCG.h:
1930         * platform/graphics/win/ImageDecoderDirect2D.h:
1931         * platform/image-decoders/ScalableImageDecoder.h:
1932         * rendering/RenderBoxModelObject.cpp:
1933         (WebCore::RenderBoxModelObject::decodingModeForImageDraw const):
1934         The element attributes and the document settings should be checked before
1935         checking our heuristics. And since the "decoding" attribute is per an image
1936         and isLargeImageAsyncDecodingEnabledForTesting() is a global setting, the
1937         decoding attribute should be checked first.
1938
1939 2017-12-06  David Quesada  <david_quesada@apple.com>
1940
1941         [Web App Manifest] Add SPI for applying a manifest to a top-level browsing context
1942         https://bugs.webkit.org/show_bug.cgi?id=180368
1943         rdar://problem/34748067
1944
1945         Reviewed by Geoffrey Garen.
1946
1947         Support applying a manifest to a top-level browsing context by adding a manifest
1948         property on PageConfiguration to be stored on MainFrame instances created from the
1949         configuration.
1950
1951         No new tests, no change in behavior.
1952
1953         * page/MainFrame.cpp:
1954         (WebCore::MainFrame::MainFrame):
1955         * page/MainFrame.h:
1956         * page/PageConfiguration.h:
1957
1958 2017-12-06  Zalan Bujtas  <zalan@apple.com>
1959
1960         Remove nodes from AXObjectCache when the associated subframe document is getting destroyed.
1961         https://bugs.webkit.org/show_bug.cgi?id=180503
1962         <rdar://problem/35891328
1963
1964         Reviewed by Chris Fleizach.
1965
1966         While AXObjectCache lives on the mainframe's document, it caches nodes from every subframe document.
1967         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
1968         Soon after the document is detached from the frame/frame is detached from the frame tree, this codepath
1969         is no longer available (no access to the AXObjectCache object) and from this point we are unable to deregister
1970         nodes associated with the current document.
1971         In AXObjectCache::prepareForDocumentDestruction(), we preemptively remove all the cached nodes associated
1972         with the about-to-be-destroyed document.
1973
1974         Covered by existing tests.
1975
1976         * accessibility/AXObjectCache.cpp:
1977         (WebCore::AXObjectCache::remove):
1978         (WebCore::filterForRemoval):
1979         (WebCore::AXObjectCache::prepareForDocumentDestruction): Collecting the nodes and removing them later is
1980         not the most performant way but in order to have a single code path for the de-registration (AXObjectCache::remove)
1981         I think it's worth going down the slower path -which should not really be that slower anyway since those
1982         lists tend to stay small.
1983         (WebCore::AXObjectCache::clearTextMarkerNodesInUse): Deleted.
1984         * accessibility/AXObjectCache.h:
1985         (WebCore::AXObjectCache::removeNodeForUse):
1986         (WebCore::AXObjectCache::remove):
1987         * dom/Document.cpp:
1988         (WebCore::Document::prepareForDestruction):
1989         * dom/Node.cpp:
1990         (WebCore::Node::willBeDeletedFrom):
1991         (WebCore::Node::moveNodeToNewDocument):
1992
1993 2017-12-06  Brady Eidson  <beidson@apple.com>
1994
1995         Start writing ServiceWorker registrations to disk.
1996         https://bugs.webkit.org/show_bug.cgi?id=180488
1997
1998         Reviewed by Chris Dumez.
1999
2000         No new tests (No observable behavior change).
2001
2002         As registrations changes occurs, we now write them to disk.
2003         We don't re-read them in yet.
2004
2005         * Sources.txt:
2006         * WebCore.xcodeproj/project.pbxproj:
2007
2008         * workers/service/ServiceWorkerRegistrationData.cpp:
2009         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
2010         * workers/service/ServiceWorkerRegistrationData.h:
2011         (WebCore::ServiceWorkerRegistrationData::encode const):
2012         (WebCore::ServiceWorkerRegistrationData::decode):
2013
2014         * workers/service/ServiceWorkerRegistrationKey.cpp:
2015         (WebCore::ServiceWorkerRegistrationKey::toDatabaseKey const):
2016         * workers/service/ServiceWorkerRegistrationKey.h:
2017
2018         * workers/service/server/RegistrationDatabase.cpp: Added.
2019         (WebCore::v1RecordsTableSchema):
2020         (WebCore::v1RecordsTableSchemaAlternate):
2021         (WebCore::databaseFilename):
2022         (WebCore::RegistrationDatabase::RegistrationDatabase):
2023         (WebCore::RegistrationDatabase::~RegistrationDatabase):
2024         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2025         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
2026         (WebCore::updateViaCacheToString):
2027         (WebCore::workerTypeToString):
2028         (WebCore::RegistrationDatabase::pushChanges):
2029         (WebCore::RegistrationDatabase::doPushChanges):
2030         (WebCore::RegistrationDatabase::importRecords):
2031         (WebCore::RegistrationDatabase::databaseFailedToOpen):
2032         (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
2033         * workers/service/server/RegistrationDatabase.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
2034         (WebCore::RegistrationDatabase::isClosed const):
2035
2036         * workers/service/server/RegistrationStore.cpp: Added.
2037         (WebCore::RegistrationStore::RegistrationStore):
2038         (WebCore::RegistrationStore::~RegistrationStore):
2039         (WebCore::RegistrationStore::scheduleDatabasePushIfNecessary):
2040         (WebCore::RegistrationStore::pushChangesToDatabase):
2041         (WebCore::RegistrationStore::updateRegistration):
2042         (WebCore::RegistrationStore::removeRegistration):
2043         (WebCore::RegistrationStore::databaseFailedToOpen):
2044         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
2045         * workers/service/server/RegistrationStore.h: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
2046
2047         * workers/service/server/SWServer.cpp:
2048         (WebCore::SWServer::removeRegistration):
2049         (WebCore::SWServer::SWServer):
2050         (WebCore::SWServer::updateWorker):
2051         (WebCore::SWServer::installContextData):
2052         * workers/service/server/SWServer.h:
2053
2054         * workers/service/server/SWServerRegistration.cpp:
2055         (WebCore::SWServerRegistration::data const):
2056         * workers/service/server/SWServerRegistration.h:
2057         (WebCore::SWServerRegistration::setLastUpdateTime):
2058
2059 2017-12-06  Chris Dumez  <cdumez@apple.com>
2060
2061         Unreviewed, fix build after r225577.
2062
2063         * bindings/js/JSDOMGlobalObject.cpp:
2064
2065 2017-12-06  David Quesada  <david_quesada@apple.com>
2066
2067         [Web App Manifest] Add SPI for fetching the manifest
2068         https://bugs.webkit.org/show_bug.cgi?id=180294
2069         rdar://problem/34747968
2070
2071         Reviewed by Geoffrey Garen.
2072
2073         Test: applicationmanifest/developer-warnings.html
2074
2075         * Modules/applicationmanifest/ApplicationManifest.h:
2076         (WebCore::ApplicationManifest::encode const):
2077         (WebCore::ApplicationManifest::decode):
2078         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
2079         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
2080         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
2081             Drive-by wording changes. Since the warning is prefixed with "parsing
2082             application manifest:", remove a redundant use of "application manifest".
2083
2084 2017-12-06  Per Arne Vollan  <pvollan@apple.com>
2085
2086         The WebProcess should use the NSRunLoop runloop type.
2087         https://bugs.webkit.org/show_bug.cgi?id=179804
2088         <rdar://problem/14012823>
2089
2090         Reviewed by Brent Fulgham.
2091
2092         No new tests.
2093
2094         * platform/mac/EventLoopMac.mm:
2095         (WebCore::EventLoop::cycle):
2096
2097 2017-12-06  Antti Koivisto  <antti@apple.com>
2098
2099         Prefer ids and classes over tag names in selector filter
2100         https://bugs.webkit.org/show_bug.cgi?id=180433
2101         <rdar://problem/35859103>
2102
2103         Reviewed by Zalan Bujtas.
2104
2105         There are only four slots in the filter and currently we just pick whatever identifiers we find traversing the selector
2106         from right to left. More specific selector types are on average more valuable (id > class > tag) so we should prefer them.
2107
2108         This appears to be 4-5% StyleBench progression.
2109
2110         * css/RuleSet.cpp:
2111         (WebCore::RuleData::RuleData):
2112         * css/SelectorFilter.cpp:
2113         (WebCore::collectSimpleSelectorHash):
2114         (WebCore::collectSelectorHashes):
2115
2116             This function collects all hashes from the selector.
2117
2118         (WebCore::chooseSelectorHashesForFilter):
2119
2120             This function chooses the most valuable hashes to use with the filter.
2121
2122         (WebCore::SelectorFilter::collectHashes):
2123
2124             Factor into two separate steps.
2125
2126         (WebCore::collectDescendantSelectorIdentifierHashes): Deleted.
2127         (WebCore::SelectorFilter::collectIdentifierHashes): Deleted.
2128         * css/SelectorFilter.h:
2129         (WebCore::SelectorFilter::fastRejectSelector const):
2130
2131 2017-12-06  Jer Noble  <jer.noble@apple.com>
2132
2133         [EME] Make CDMInstance& parameter passed through MediaPlayer non-const
2134         https://bugs.webkit.org/show_bug.cgi?id=180484
2135
2136         Reviewed by Jon Lee.
2137
2138         One can only call const methods on const references, and the obvious intent
2139         of these methods is for the callee to call non-const methods on the parameters.
2140
2141         * Modules/encryptedmedia/MediaKeys.h:
2142         (WebCore::MediaKeys::cdmInstance):
2143         * platform/graphics/MediaPlayer.cpp:
2144         (WebCore::MediaPlayer::cdmInstanceAttached):
2145         (WebCore::MediaPlayer::cdmInstanceDetached):
2146         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
2147         * platform/graphics/MediaPlayer.h:
2148         * platform/graphics/MediaPlayerPrivate.h:
2149         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
2150         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
2151         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
2152         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2153         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
2154         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
2155         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
2156         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2157         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2158         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
2159         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2160
2161 2017-12-06  Youenn Fablet  <youenn@apple.com>
2162
2163         Preflight should bypass service worker
2164         https://bugs.webkit.org/show_bug.cgi?id=180463
2165
2166         Reviewed by Alex Christensen.
2167
2168         Covered by updated test.
2169
2170         * loader/CrossOriginPreflightChecker.cpp:
2171         (WebCore::CrossOriginPreflightChecker::startPreflight): Ensure service worker is not used.
2172         * loader/DocumentThreadableLoader.cpp:
2173         (WebCore::DocumentThreadableLoader::didFail): Tighten check and clear resource proactively to not hit loadRequest ASSERT.
2174
2175 2017-12-06  John Wilander  <wilander@apple.com>
2176
2177         Storage Access API: Make document.hasStorageAccess a function and always allow access for same-origin iframes
2178         https://bugs.webkit.org/show_bug.cgi?id=176944
2179         <rdar://problem/34440658>
2180
2181         Reviewed by Brent Fulgham.
2182
2183         Test: http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-user-gesture.html
2184
2185         This change introduces document.hasStorageAccess() as a function which
2186         returns a promise instead of being a property. Since cookie access can
2187         be due to both a granted request and recent user interaction as first
2188         party, the WebKit::WebResourceLoadStatisticsStore needs to be consulted.
2189
2190         * dom/Document.cpp:
2191         (WebCore::Document::hasStorageAccess):
2192         (WebCore::Document::requestStorageAccess):
2193             Removed check of the previous m_hasStorageAccess member.
2194             Same-origin check done earlier. This was a request/suggestion
2195             from Mozilla.
2196         * dom/Document.h:
2197         (WebCore::Document::hasStorageAccess const): Deleted.
2198             Now uses a promise.
2199         * dom/Document.idl:
2200         * page/ChromeClient.h:
2201
2202 2017-12-06  Youenn Fablet  <youenn@apple.com>
2203
2204         REGRESSION (r225537): Crash in WebCore::SWServerWorker::setHasPendingEvents(bool) + 68
2205         https://bugs.webkit.org/show_bug.cgi?id=180481
2206
2207         Reviewed by Chris Dumez.
2208
2209         Replacing ASSERT by if null check since there is no strong guarantee right now that there is a registration
2210         in SWServer registration map associated to a SWServerWorker.
2211
2212         * workers/service/server/SWServerWorker.cpp:
2213         (WebCore::SWServerWorker::setHasPendingEvents):
2214
2215 2017-12-06  Chris Dumez  <cdumez@apple.com>
2216
2217         ServiceWorkers API should reject promises when calling objects inside detached frames
2218         https://bugs.webkit.org/show_bug.cgi?id=180444
2219
2220         Reviewed by Youenn Fablet.
2221
2222         ServiceWorkers API should reject promises when calling objects inside detached frames.
2223
2224         No new tests, rebaselined existing test.
2225
2226         * bindings/js/JSDOMPromiseDeferred.h:
2227         (WebCore::callPromiseFunction):
2228         Use the caller's globalObject instead of the lexicalGlobalObject when constructing the
2229         deferred promise. The bug became visible when working on this service worker bug since
2230         rejecting the promise when the frame is detached did not actually work. The issue is
2231         that since the promise was created with the detached frame's globalObject, then it was
2232         suspended and would not run script.
2233
2234         * bindings/js/JSDOMWindowBase.cpp:
2235         (WebCore::callerGlobalObject):
2236         (WebCore::incumbentDOMWindow):
2237         * bindings/js/JSDOMWindowBase.h:
2238         Add convenience function to get the caller's globalObject. It was carved out of
2239         incumbentDOMWindow().
2240
2241         * workers/service/ServiceWorker.cpp:
2242         (WebCore::ServiceWorker::postMessage):
2243         * workers/service/ServiceWorkerContainer.cpp:
2244         (WebCore::ServiceWorkerContainer::addRegistration):
2245         (WebCore::ServiceWorkerContainer::getRegistration):
2246         (WebCore::ServiceWorkerContainer::getRegistrations):
2247         * workers/service/ServiceWorkerRegistration.cpp:
2248         (WebCore::ServiceWorkerRegistration::update):
2249         (WebCore::ServiceWorkerRegistration::unregister):
2250         Reject the promise when m_isStopped flag is set (i.e. ActiveDOMObject::stop()
2251         has been called).
2252
2253 2017-12-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
2254
2255         [Mac] REGRESSION (r224527): Drawing a path with box-shadow takes double the blur-radius on Retina display
2256         https://bugs.webkit.org/show_bug.cgi?id=180460
2257         <rdar://problem/35869866>
2258
2259         Reviewed by Daniel Bates.
2260
2261         Disable using CGContextDrawPathDirect() for macOS High Sierra or earlier.
2262         This API has a bug when drawing a path with a shadow on Retina display.
2263         This bug is tracked internally by <rdar://problem/35620690>.
2264
2265
2266         * platform/graphics/cg/GraphicsContextCG.cpp:
2267
2268 2017-12-06  Youenn Fablet  <youenn@apple.com>
2269
2270         Service Worker fetch should filter HTTP headers that are added by CachedResourceLoader/CachedResource
2271         https://bugs.webkit.org/show_bug.cgi?id=180462
2272
2273         Reviewed by Geoffrey Garen.
2274
2275         Coved by rebased test.
2276
2277         * loader/CrossOriginAccessControl.cpp:
2278         (WebCore::cleanRedirectedRequestForAccessControl): Accept header is a safe header so it is fine to keep it.
2279         * workers/service/context/ServiceWorkerFetch.cpp:
2280         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Cleaning headers added by CachedResourceLoader/CachedResource.
2281
2282 2017-12-06  Zan Dobersek  <zdobersek@igalia.com>
2283
2284         [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
2285         https://bugs.webkit.org/show_bug.cgi?id=180239
2286
2287         Reviewed by Michael Catanzaro.
2288
2289         As the next step in the Nicosia abstraction formation, we introduce
2290         Nicosia::PaintingContext. Implementations of this class will leverage a
2291         chosen 2D graphics library to paint (through GraphicsContext) into the
2292         memory area that's specified by a given Nicosia::Buffer object.
2293
2294         Nicosia::Buffer is slimmed down to only control the memory that's
2295         required for rasterization of an RGBA32 painting output. It mimics the
2296         Cairo ImageBuffer implementation by using FastMalloc to allocate the
2297         necessary memory. In the future this class might become an interface of
2298         which different implementations will be providing memory that's
2299         allocated through different ways. For instance, when GLES3 is available,
2300         it would be possible to map GPU memory into the process memory space and
2301         rasterize into that, effectively eliminating need for GPU uploads.
2302
2303         Since the ImageBuffer use in Nicosia::Buffer is dropped, the context()
2304         and uploadImage() methods are also removed. The functionality of
2305         ImageBuffer that was leveraged for CoordinatedGraphics rasterization
2306         still remains used through the PaintingContextCairo implementation. In
2307         the constructor of that class, with the target Nicosia::Buffer provided,
2308         we construct the cairo_surface_t and cairo_t objects that are necessary
2309         to create a combination of PlatformContextCairo and GraphicsContext
2310         objects that we can then use for rasterization.
2311
2312         Reference of the passed-in Nicosia::Buffer object is increased for the
2313         lifetime of the cairo_surface_t object that will be drawing into that
2314         buffer's memory area. This ensures the memory area doesn't disappear
2315         from a live cairo_surface_t. Still, the expectation is that the
2316         cairo_surface_t object won't outlive the PaintingContextCairo object's
2317         lifetime, since the cairo_t object is also managed here and deleted in
2318         the destructor. To test that, we use a cairo_surface_t user data key
2319         that in its destroy callback dereferences the Nicosia::Buffer object and
2320         also marks the deletion process for the related PaintingContextCairo
2321         object as complete. This m_deletionComplete value is tested in the
2322         destructor of the class, once all the Cairo references are nulled out.
2323
2324         The PaintingContext objects should be limited to a single scope,
2325         enabling the implementation resources to assume that the lifetime of the
2326         implementation object won't extend outside of the scope where it was
2327         created. To ensure that, the PaintingContext::paint() static function is
2328         added that creates the PaintingContext object and then executes the
2329         passed-in functor, passing it the GraphicsContext that should be used
2330         for drawing. Drawing is thus limited to that functor only, and the
2331         PaintingContext's create() function and the virtual graphicsContext()
2332         are not made public in the class.
2333
2334         No new tests -- no change in functionality.
2335
2336         * platform/TextureMapper.cmake:
2337         * platform/graphics/nicosia/NicosiaBuffer.cpp:
2338         (Nicosia::Buffer::Buffer):
2339         (Nicosia::Buffer::context): Deleted.
2340         (Nicosia::Buffer::uploadImage): Deleted.
2341         * platform/graphics/nicosia/NicosiaBuffer.h:
2342         (Nicosia::Buffer::stride const):
2343         (Nicosia::Buffer::data const):
2344         * platform/graphics/nicosia/NicosiaPaintingContext.cpp: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
2345         (Nicosia::PaintingContext::create):
2346         * platform/graphics/nicosia/NicosiaPaintingContext.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp.
2347         (Nicosia::PaintingContext::paint):
2348         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp: Added.
2349         (Nicosia::PaintingContextCairo::PaintingContextCairo):
2350         (Nicosia::PaintingContextCairo::~PaintingContextCairo):
2351         (Nicosia::PaintingContextCairo::graphicsContext):
2352         * platform/graphics/nicosia/NicosiaPaintingContextCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.h.
2353         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp:
2354         (Nicosia::PaintingEngineBasic::paint):
2355         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2356         (WebCore::CoordinatedImageBacking::update):
2357
2358 2017-12-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2359
2360         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html crashes and times out
2361         https://bugs.webkit.org/show_bug.cgi?id=160131
2362
2363         Reviewed by Eric Carlson.
2364
2365         Null dereference can be happen if VideoTrack and AudioTrack are
2366         disconnected from its media element.
2367
2368         No new tests, no behavior change.
2369
2370         * html/track/AudioTrack.cpp:
2371         (WebCore::AudioTrack::willRemove): Null-check mediaElement.
2372         * html/track/VideoTrack.cpp:
2373         (WebCore::VideoTrack::setLanguage): Ditto.
2374
2375 2017-12-05  Chris Dumez  <cdumez@apple.com>
2376
2377         ServiceWorkerGlobalScope prototype chain should be immutable
2378         https://bugs.webkit.org/show_bug.cgi?id=180450
2379
2380         Reviewed by Youenn Fablet.
2381
2382         ServiceWorkerGlobalScope prototype chain should be immutable, similarly
2383         to what we do for DOMWindow. This is covered by a web-platform-test
2384         which was timing out because it was successfuly overwriting the
2385         ServiceWorkerGlobalScope prototype.
2386
2387         No new tests, rebaselined existing test.
2388
2389         * workers/DedicatedWorkerGlobalScope.idl:
2390         * workers/WorkerGlobalScope.idl:
2391         * workers/service/ServiceWorkerGlobalScope.idl:
2392
2393 2017-12-05  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2394
2395         Fast binding generation by batching several files at once
2396         https://bugs.webkit.org/show_bug.cgi?id=179958
2397
2398         Reviewed by Alex Christensen.
2399
2400         Passing several files to the sub process at once and reducing the total cost of
2401         process generation. Especially Windows port has great speed improvement because
2402         its implementation of fork/exec is terrible.
2403
2404         * bindings/scripts/generate-bindings-all.pl:
2405         (spawnGenerateBindingsIfNeeded):
2406         * bindings/scripts/generate-bindings.pl:
2407         (generateBindings):
2408
2409 2017-12-05  David Quesada  <david_quesada@apple.com>
2410
2411         [Web App Manifest] Support fetching the app manifest 
2412         https://bugs.webkit.org/show_bug.cgi?id=180292
2413
2414         Reviewed by Geoffrey Garen.
2415
2416         Add support in WebCore for loading and parsing application manifests. This functionality
2417         is currently exposed with two methods: DocumentLoader::loadApplicationManifest() to call
2418         to start loading the manifest, and FrameLoaderClient::finishedLoadingApplicationManifest()
2419         for clients to override in order to be notified of the loaded manifest.
2420
2421         No new tests, since no functionality is exposed to web content or embedders yet. The
2422         needed SPI will be added in an upcoming patch.
2423
2424         * Sources.txt:
2425         * WebCore.xcodeproj/project.pbxproj:
2426             Added CachedApplicationManifest and ApplicationManifestLoader.
2427         * html/HTMLLinkElement.h:
2428         * html/LinkRelAttribute.cpp:
2429         (WebCore::LinkRelAttribute::LinkRelAttribute):
2430         (WebCore::LinkRelAttribute::isSupported):
2431             Add "manifest" as a supported 'rel' type for links.
2432         * html/LinkRelAttribute.h:
2433         * inspector/agents/InspectorPageAgent.cpp:
2434         (WebCore::InspectorPageAgent::resourceTypeJSON):
2435         (WebCore::InspectorPageAgent::inspectorResourceType):
2436         * inspector/agents/InspectorPageAgent.h:
2437         * loader/ApplicationManifestLoader.cpp: Added.
2438             Added a class ApplicationManifestLoader which handles creating a ResourceRequest,
2439             loading the resource from the CachedResourceLoader, and parsing the resulting text.
2440             This class and its relation to DocumentLoader are roughly based on that of IconLoader,
2441             which serves a similar purpose - requesting a resource on the page and ultimately
2442             providing it to the embedder.
2443         (WebCore::ApplicationManifestLoader::ApplicationManifestLoader):
2444         (WebCore::ApplicationManifestLoader::~ApplicationManifestLoader):
2445         (WebCore::ApplicationManifestLoader::startLoading):
2446         (WebCore::ApplicationManifestLoader::stopLoading):
2447         (WebCore::ApplicationManifestLoader::processManifest):
2448         (WebCore::ApplicationManifestLoader::notifyFinished):
2449         * loader/ApplicationManifestLoader.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
2450         * loader/DocumentLoader.cpp:
2451         (WebCore::DocumentLoader::stopLoading):
2452         (WebCore::DocumentLoader::loadApplicationManifest):
2453         (WebCore::DocumentLoader::finishedLoadingApplicationManifest):
2454         (WebCore::DocumentLoader::notifyFinishedLoadingApplicationManifest):
2455         * loader/DocumentLoader.h:
2456         * loader/FrameLoaderClient.h:
2457         * loader/LinkLoader.cpp:
2458         (WebCore::createLinkPreloadResourceClient):
2459         (WebCore::LinkLoader::isSupportedType):
2460         * loader/ResourceLoadInfo.cpp:
2461         (WebCore::toResourceType):
2462         * loader/SubresourceLoader.cpp:
2463         (WebCore::logResourceLoaded):
2464         * loader/cache/CachedApplicationManifest.cpp: Added.
2465         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
2466         (WebCore::CachedApplicationManifest::finishLoading):
2467         (WebCore::CachedApplicationManifest::setEncoding):
2468         (WebCore::CachedApplicationManifest::encoding const):
2469         (WebCore::CachedApplicationManifest::process):
2470             Add a method to process the fetched text into an ApplicationManifest. CachedApplicationManifest
2471             does not store the resulting ApplicationManifest because the text of an application
2472             manifest can yield a different ApplicationManifest depending on the URL of the document
2473             processing it.
2474         * loader/cache/CachedApplicationManifest.h: Copied from Source/WebCore/page/csp/ContentSecurityPolicyDirectiveNames.h.
2475         * loader/cache/CachedResource.cpp:
2476         (WebCore::CachedResource::defaultPriorityForResourceType):
2477         * loader/cache/CachedResource.h:
2478         * loader/cache/CachedResourceLoader.cpp:
2479         (WebCore::createResource):
2480         (WebCore::CachedResourceLoader::requestApplicationManifest):
2481         (WebCore::contentTypeFromResourceType):
2482         (WebCore::CachedResourceLoader::checkInsecureContent const):
2483         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
2484         * loader/cache/CachedResourceLoader.h:
2485         * page/DiagnosticLoggingKeys.cpp:
2486         (WebCore::DiagnosticLoggingKeys::applicationManifestKey):
2487         * page/DiagnosticLoggingKeys.h:
2488         * page/csp/ContentSecurityPolicy.cpp:
2489         (WebCore::ContentSecurityPolicy::allowManifestFromSource const):
2490         * page/csp/ContentSecurityPolicy.h:
2491         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2492         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForManifest const):
2493         (WebCore::ContentSecurityPolicyDirectiveList::addDirective):
2494         * page/csp/ContentSecurityPolicyDirectiveList.h:
2495         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
2496         * page/csp/ContentSecurityPolicyDirectiveNames.h:
2497
2498 2017-12-05  Stephan Szabo  <stephan.szabo@sony.com>
2499
2500         Switch windows build to Visual Studio 2017
2501         https://bugs.webkit.org/show_bug.cgi?id=172412
2502
2503         Reviewed by Per Arne Vollan.
2504
2505         Only changes proj file to update generator
2506
2507         * WebCore.vcxproj/WebCore.proj:
2508
2509 2017-12-05  Brent Fulgham  <bfulgham@apple.com>
2510
2511         Limit user agent versioning to an upper bound
2512         https://bugs.webkit.org/show_bug.cgi?id=180365
2513         <rdar://problem/34550617>
2514
2515         Reviewed by Joseph Pecoraro.
2516
2517         Freeze the version reported as User Agent to OS 10.13.4 (OS 11.3 on iOS) and WebKit 605.1.15
2518         for User Agent purposes.
2519
2520         Test: fast/dom/navigator-userAgent-frozen.html
2521
2522         * page/cocoa/UserAgent.h:
2523         * page/cocoa/UserAgent.mm:
2524         (WebCore::versionPredatesFreeze): Helper function. Returns true for Version 10.13.3 or older.
2525         (WebCore::systemMarketingVersionForUserAgentString):
2526         (WebCore::userAgentBundleVersion):
2527         (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Deleted.
2528         (WebCore::userAgentBundleVersionFromFullVersionString): Deleted.
2529         * page/ios/UserAgentIOS.mm:
2530         (WebCore::standardUserAgentWithApplicationName): Don't take the WebKit bundle version
2531         as an argument, or pass it to the user agent string generator.
2532         * page/mac/UserAgentMac.mm:
2533         (WebCore::standardUserAgentWithApplicationName): Ditto. 
2534
2535 2017-12-05  Matt Lewis  <jlewis3@apple.com>
2536
2537         Unreviewed, rolling out r225430.
2538
2539         This caused an API failure on release.
2540
2541         Reverted changeset:
2542
2543         "Move DateComponents into WTF"
2544         https://bugs.webkit.org/show_bug.cgi?id=180211
2545         https://trac.webkit.org/changeset/225430
2546
2547 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
2548
2549         Composited frames incorrectly get requestAnimationFrame throttled
2550         https://bugs.webkit.org/show_bug.cgi?id=178396
2551
2552         Reviewed by Zalan Bujtas.
2553
2554         If a composited iframe was inside overflow:scroll, and the overflow was scrolled to the left
2555         further than the window width, then RenderLayer::childrenClipRect() would return an empty rectangle
2556         and we'd incorrectly consider the iframe out of view, and thus throttle its requestAnimationFrame.
2557
2558         childrenClipRect() was taking unscaledDocumentRect(), applying the clip, and then mapping the result
2559         from local to absolute coordinates (which mapped it through the overflow scroll offset). This is incorrect
2560         because it considers the unscaledDocumentRect() to be in local coordinates, which it is not.
2561
2562         Instead, start with the infinite rect, which essentially tells us if we have any clipping, and then
2563         intersect that with the document rect at the end. Something similar is done in other places that call.
2564         calculateRects().
2565
2566         Test: fast/animation/request-animation-frame-throttle-inside-overflow-scroll.html
2567
2568         * rendering/RenderLayer.cpp:
2569         (WebCore::RenderLayer::calculateClipRects const):
2570
2571 2017-12-05  Michael Saboff  <msaboff@apple.com>
2572
2573         Make WebKit build for ARM64_32
2574         https://bugs.webkit.org/show_bug.cgi?id=180447
2575
2576         Reviewed by Mark Lam.
2577
2578         No new test as this isn't a change to functionality.
2579
2580         * platform/graphics/transforms/TransformationMatrix.cpp:
2581         (WebCore::TransformationMatrix::multiply): Fallback to the C++ version for
2582         ARM64_32.
2583
2584 2017-12-05  Chris Dumez  <cdumez@apple.com>
2585
2586         XMLHttpRequest should not be exposed to service workers
2587         https://bugs.webkit.org/show_bug.cgi?id=180446
2588
2589         Reviewed by Youenn Fablet.
2590
2591         Stop exposing XMLHttpRequest to service workers, as per:
2592         - https://xhr.spec.whatwg.org/#interface-xmlhttprequest
2593
2594         * xml/XMLHttpRequest.idl:
2595
2596 2017-12-05  Joseph Pecoraro  <pecoraro@apple.com>
2597
2598         Web Inspector: content views for resources loaded through XHR do not reflect declared mime-type
2599         https://bugs.webkit.org/show_bug.cgi?id=141389
2600         <rdar://problem/19767070>
2601
2602         Reviewed by Brian Burg.
2603
2604         Updated: http/tests/inspector/network/xhr-response-body.html:
2605                  http/tests/inspector/network/fetch-response-body.html:
2606
2607         * xml/XMLHttpRequest.cpp:
2608         (WebCore::XMLHttpRequest::didFinishLoading):
2609         * inspector/InspectorInstrumentation.cpp:
2610         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl): Deleted.
2611         * inspector/InspectorInstrumentation.h:
2612         (WebCore::InspectorInstrumentation::didFinishXHRLoading): Deleted.
2613         Remove special handling of XHR content that decoded output as text.
2614
2615         * inspector/NetworkResourcesData.h:
2616         (WebCore::NetworkResourcesData::ResourceData::requestId const):
2617         (WebCore::NetworkResourcesData::ResourceData::loaderId const):
2618         (WebCore::NetworkResourcesData::ResourceData::frameId const):
2619         (WebCore::NetworkResourcesData::ResourceData::url const):
2620         (WebCore::NetworkResourcesData::ResourceData::content const):
2621         (WebCore::NetworkResourcesData::ResourceData::isContentEvicted const):
2622         (WebCore::NetworkResourcesData::ResourceData::textEncodingName const):
2623         * inspector/NetworkResourcesData.cpp:
2624         (WebCore::NetworkResourcesData::ResourceData::ResourceData):
2625         (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
2626         (WebCore::NetworkResourcesData::responseReceived):
2627         (WebCore::NetworkResourcesData::setResourceContent):
2628         (WebCore::shouldBufferResourceData):
2629         (WebCore::NetworkResourcesData::maybeAddResourceData):
2630         (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
2631
2632         Make NetworkResourcesData only create a text decoder for resources we
2633         really think are text, and buffer resource data if it is text data
2634         or if it is a resource that would otherwise not be buffered by WebCore
2635         (such as XHRs with a DoNotBufferData policy). This ensures that the
2636         Inspector will have data to show for resources that won't be cached.
2637
2638         * inspector/agents/InspectorPageAgent.cpp:
2639         (WebCore::InspectorPageAgent::resourceContent):
2640         (WebCore::InspectorPageAgent::sourceMapURLForResource):
2641         (WebCore::InspectorPageAgent::searchInResource):
2642         (WebCore::InspectorPageAgent::searchInResources):
2643         (WebCore::hasTextContent): Deleted.
2644         (WebCore::InspectorPageAgent::cachedResourceContent): Deleted.
2645         (WebCore::InspectorPageAgent::createTextDecoder): Deleted.
2646         (WebCore::textContentForCachedResource): Deleted.
2647         * inspector/agents/InspectorPageAgent.h:
2648         * inspector/agents/InspectorNetworkAgent.cpp:
2649         (WebCore::InspectorNetworkAgent::didReceiveData):
2650         (WebCore::InspectorNetworkAgent::willDestroyCachedResource):
2651         (WebCore::InspectorNetworkAgent::getResponseBody):
2652         (WebCore::InspectorNetworkAgent::shouldTreatAsText):
2653         (WebCore::InspectorNetworkAgent::createTextDecoder):
2654         (WebCore::InspectorNetworkAgent::textContentForCachedResource):
2655         (WebCore::InspectorNetworkAgent::cachedResourceContent):
2656         (WebCore::textContentForResourceData):
2657         (WebCore::InspectorNetworkAgent::searchOtherRequests):
2658         (WebCore::isErrorStatusCode): Deleted.
2659         (WebCore::InspectorNetworkAgent::didFinishXHRLoading): Deleted.
2660         * inspector/agents/InspectorNetworkAgent.h:
2661         Move static PageAgent functions related to the generic data tuple
2662         (content, base64Encoded) to NetworkAgent. Also generalize it to
2663         not rely on the CachedResourceType, but instead rely on the MIME type.
2664         This has a few changes in behavior:
2665
2666             - Images, may now be text if they have a text mime type (image/svg+xml).
2667             - XHR / Fetch / Other may be sent as text if they have a text mime type.
2668             - XHR / Fetch / Other are not assumed to be text, and may be sent as base64 encoded.
2669         
2670         For this to be useful the frontend should also check the mime type and
2671         display an appropriate ContentView.
2672
2673 2017-12-05  Youenn Fablet  <youenn@apple.com>
2674
2675         Implement https://w3c.github.io/ServiceWorker/#clients-claim
2676         https://bugs.webkit.org/show_bug.cgi?id=180261
2677
2678         Reviewed by Chris Dumez.
2679
2680         Test: http/tests/workers/service/serviceworkerclients-claim.https.html
2681
2682         Implement claim by going to the storage process and then iterate over clients to see whether active worker can be set.
2683         Update SWServerWorker to call registration tryClear/tryActivate whenever a service worker has no pending event.
2684
2685         * workers/service/ServiceWorkerClients.cpp:
2686         (WebCore::ServiceWorkerClients::claim):
2687         * workers/service/context/SWContextManager.h:
2688         * workers/service/server/SWServer.cpp:
2689         (WebCore::SWServer::claim):
2690         (WebCore::SWServer::doRegistrationMatching):
2691         (WebCore::SWServer::doRegistrationMatching const): Deleted.
2692         * workers/service/server/SWServer.h:
2693         (WebCore::SWServer::Connection::doRegistrationMatching):
2694         * workers/service/server/SWServerRegistration.cpp:
2695         (WebCore::SWServerRegistration::controlClient):
2696         * workers/service/server/SWServerRegistration.h:
2697         * workers/service/server/SWServerToContextConnection.cpp:
2698         (WebCore::SWServerToContextConnection::claim):
2699         * workers/service/server/SWServerToContextConnection.h:
2700         * workers/service/server/SWServerWorker.cpp:
2701         (WebCore::SWServerWorker::claim):
2702         * workers/service/server/SWServerWorker.h:
2703
2704 2017-12-05  Per Arne Vollan  <pvollan@apple.com>
2705
2706         [Win] Scrollbars are sometimes not rendered in accelerated compositing mode.
2707         https://bugs.webkit.org/show_bug.cgi?id=180431
2708         <rdar://problem/34531264>
2709
2710         Reviewed by Simon Fraser.
2711
2712         No new tests, covered by existing tests.
2713
2714         When a scroll layer is required, we will create an overflow control hosts layer.
2715         In this case the method RenderLayerCompositor::shouldCompositeOverflowControls()
2716         should return true, otherwise the scrollbars will not be rendered.
2717  
2718         * rendering/RenderLayerCompositor.cpp:
2719         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
2720
2721 2017-12-05  Youenn Fablet  <youenn@apple.com>
2722
2723         Call "Terminate Service Worker" on all workers when all their clients are gone
2724         https://bugs.webkit.org/show_bug.cgi?id=179552
2725         <rdar://problem/35836323>
2726
2727         Unreviewed.
2728
2729         * workers/service/server/SWServer.cpp: Reducing from 60_s to 10_s based on bugzilla comment.
2730
2731 2017-12-05  Chris Dumez  <cdumez@apple.com>
2732
2733         Add support for ServiceWorkerContainer.prototype.ready
2734         https://bugs.webkit.org/show_bug.cgi?id=180383
2735
2736         Reviewed by Youenn Fablet.
2737
2738         Add support for ServiceWorkerContainer.prototype.ready:
2739         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-ready
2740
2741         No new tests, rebaselined existing test.
2742
2743         * workers/service/SWClientConnection.h:
2744         * workers/service/ServiceWorkerContainer.cpp:
2745         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
2746         (WebCore::ServiceWorkerContainer::ready):
2747         * workers/service/ServiceWorkerContainer.h:
2748         * workers/service/ServiceWorkerRegistrationKey.h:
2749         * workers/service/server/SWServer.cpp:
2750         (WebCore::SWServer::resolveRegistrationReadyRequests):
2751         * workers/service/server/SWServer.h:
2752         * workers/service/server/SWServerRegistration.cpp:
2753         (WebCore::SWServerRegistration::activate):
2754         (WebCore::SWServerRegistration::setIsUninstalling):
2755         * workers/service/server/SWServerRegistration.h:
2756
2757 2017-12-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2758
2759         Modernize WebThread code for further refactoring
2760         https://bugs.webkit.org/show_bug.cgi?id=180344
2761
2762         Reviewed by Alex Christensen.
2763
2764         When touching Thread and its initialization component, we need to touch
2765         web thread initialization code too. However, since web thread code is old,
2766         it's style is not following to WebKit coding style guidelines.
2767
2768         This patch first modernizes WebThread code for further refactoring.
2769
2770         1. `Type*` instead of `Type *`.
2771         2. Use std::call_once instead of pthread_once.
2772         3. Use static_cast instead of C-cast.
2773         4. Use nullptr instead of NULL.
2774         5. Use `ret` or `!ret` instead of `ret != 0` or `ret == 0`.
2775         6. Do not use #pragma unused.
2776         7. if-else with one statement should not have braces.
2777
2778         In this patch, we do not change pthread_condition_t to WTF::Condition and
2779         pthread_mutex_t to WTF::Lock since web thread code requires extra care about
2780         threading.
2781
2782         No behavior change.
2783
2784         * platform/ios/wak/WebCoreThread.mm:
2785         (-[NSObject releaseOnMainThread]):
2786         (SendMessage):
2787         (HandleDelegateSource):
2788         (SendDelegateMessage):
2789         (WebThreadAdoptAndRelease):
2790         (lockWebCoreReleaseLock):
2791         (unlockWebCoreReleaseLock):
2792         (WebCoreObjCDeallocOnWebThreadImpl):
2793         (WebCoreObjCDeallocWithWebThreadLockImpl):
2794         (HandleWebThreadReleaseSource):
2795         (WebThreadCallDelegate):
2796         (WebThreadPostNotification):
2797         (WebThreadCallDelegateAsync):
2798         (WebThreadMakeNSInvocation):
2799         (MainRunLoopAutoUnlock):
2800         (_WebThreadAutoLock):
2801         (WebRunLoopLock):
2802         (WebRunLoopUnlock):
2803         (MainRunLoopUnlockGuard):
2804         (CurrentThreadContext):
2805         (RunWebThread):
2806         (StartWebThread):
2807         (WebTimedConditionLock):
2808         (_WebTryThreadLock):
2809         (WebThreadUnlockFromAnyThread):
2810         (WebThreadUnlockGuardForMail):
2811         (_WebThreadUnlock):
2812         (WebThreadIsLocked):
2813         (WebThreadLockPopModal):
2814         (WebThreadCurrentContext):
2815         (WebThreadEnable):
2816         (FreeThreadContext): Deleted.
2817         (InitThreadContextKey): Deleted.
2818
2819 2017-12-05  Alex Christensen  <achristensen@webkit.org>
2820
2821         Fix non-unified build after r225381
2822         https://bugs.webkit.org/show_bug.cgi?id=180434
2823
2824         Reviewed by Keith Miller.
2825
2826         * loader/ResourceTimingInformation.cpp:
2827         FrameLoader.h is included in other files that are combined with this file in unified builds,
2828         but we need to merge r225381 to a branch that doesn't use unified builds.  This build failure
2829         would've come up randomly in the future when we add files, too.
2830
2831 2017-12-05  Simon Fraser  <simon.fraser@apple.com>
2832
2833         Remove webkitGetImageDataHD and webkitPutImageDataHD from canvas API
2834         https://bugs.webkit.org/show_bug.cgi?id=180387
2835
2836         Reviewed by Dean Jackson.
2837
2838         CanvasRenderingContext2D.webkitGetImageDataHD and webkitPutImageDataHD were never standardized,
2839         and Blink removed support in 2014 (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/FOPH5dloGG8).
2840
2841         Since our canvas backing store is always 1x, they have no use anyway, so remove them.
2842
2843         * html/canvas/CanvasRenderingContext2D.cpp:
2844         (WebCore::CanvasRenderingContext2D::putImageData):
2845         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD const): Deleted.
2846         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Deleted.
2847         * html/canvas/CanvasRenderingContext2D.h:
2848         * html/canvas/CanvasRenderingContext2D.idl:
2849
2850 2017-12-05  Youenn Fablet  <youenn@apple.com>
2851
2852         Implement setting of service worker to client in SWServer without going to WebProcess
2853         https://bugs.webkit.org/show_bug.cgi?id=180382
2854
2855         Reviewed by Chris Dumez.
2856
2857         No change of behavior.
2858
2859         This patch removes the notification of active worker setting from ScriptExecution/WebProcess up to SWServer/StorageProcess.
2860         Instead, active worker setting is fully done/controlled in SWServer.
2861         Whenever there is a change, SWServer notifies WebProcess and ScriptExecutionContext gets updated accordingly.
2862
2863         * dom/Document.cpp:
2864         (WebCore::Document::setServiceWorkerConnection):
2865         * dom/ScriptExecutionContext.cpp:
2866         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
2867         * loader/DocumentLoader.cpp:
2868         (WebCore::DocumentLoader::commitData):
2869         * workers/service/SWClientConnection.h:
2870         * workers/service/server/SWServer.cpp:
2871         (WebCore::SWServer::setClientActiveWorker):
2872         (WebCore::SWServer::registerServiceWorkerClient):
2873         (WebCore::SWServer::registrationFromServiceWorkerIdentifier):
2874         (WebCore::SWServer::unregisterServiceWorkerClient):
2875         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient): Deleted.
2876         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient): Deleted.
2877         (WebCore::SWServer::serviceWorkerStartedControllingClient): Deleted.
2878         (WebCore::SWServer::serviceWorkerStoppedControllingClient): Deleted.
2879         * workers/service/server/SWServer.h:
2880         * workers/service/server/SWServerRegistration.cpp:
2881         (WebCore::SWServerRegistration::activate):
2882
2883 2017-12-01  Filip Pizlo  <fpizlo@apple.com>
2884
2885         GC constraint solving should be parallel
2886         https://bugs.webkit.org/show_bug.cgi?id=179934
2887
2888         Reviewed by JF Bastien.
2889
2890         No new tests because no change in behavior. This change is best tested using DOM-GC-intensive
2891         benchmarks like Speedometer and Dromaeo.
2892         
2893         This parallelizes the DOM's output constraint, and makes some small changes to make this more
2894         scalable.
2895
2896         * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Added.
2897         * ForwardingHeaders/heap/VisitingTimeout.h: Removed.
2898         * Sources.txt:
2899         * WebCore.xcodeproj/project.pbxproj:
2900         * bindings/js/DOMGCOutputConstraint.cpp: Added.
2901         (WebCore::DOMGCOutputConstraint::DOMGCOutputConstraint):
2902         (WebCore::DOMGCOutputConstraint::~DOMGCOutputConstraint):
2903         (WebCore::DOMGCOutputConstraint::executeImpl):
2904         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl):
2905         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl):
2906         * bindings/js/DOMGCOutputConstraint.h: Added.
2907         * bindings/js/WebCoreJSClientData.cpp:
2908         (WebCore::JSVMClientData::initNormalWorld):
2909         * dom/Node.cpp:
2910         (WebCore::Node::eventTargetDataConcurrently):
2911         (WebCore::Node::ensureEventTargetData):
2912         (WebCore::Node::clearEventTargetData):
2913
2914 2017-12-05  Antoine Quint  <graouts@apple.com>
2915
2916         <video> and scale() transforms yield shrunk small or clipped controls
2917         https://bugs.webkit.org/show_bug.cgi?id=180358
2918         <rdar://problem/34436124>
2919
2920         Unreviewed.
2921
2922         Use DOMMatrix vs. WebKitCSSMatrix per Simon's post-commit review feedback.
2923
2924         * Modules/modern-media-controls/media/media-controller.js:
2925         (MediaController.prototype._updateControlsSize):
2926
2927 2017-12-04  Chris Dumez  <cdumez@apple.com>
2928
2929         Support container.getRegistration() / getRegistrations() inside service workers
2930         https://bugs.webkit.org/show_bug.cgi?id=180360
2931
2932         Reviewed by Youenn Fablet.
2933
2934         Support container.getRegistration() / getRegistrations() inside service workers
2935         by making sure we hop to the right thread when needed.
2936
2937         Test: http/tests/workers/service/ServiceWorkerGlobalScope_getRegistration.html
2938
2939         * dom/ScriptExecutionContext.cpp:
2940         (WebCore::ScriptExecutionContext::postTaskTo):
2941         * dom/ScriptExecutionContext.h:
2942         * workers/service/SWClientConnection.cpp:
2943         (WebCore::SWClientConnection::jobRejectedInServer):
2944         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2945         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2946         (WebCore::SWClientConnection::startScriptFetchForServer):
2947         (WebCore::SWClientConnection::clearPendingJobs):
2948         * workers/service/SWClientConnection.h:
2949         * workers/service/ServiceWorkerContainer.cpp:
2950         (WebCore::ServiceWorkerContainer::getRegistration):
2951         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
2952         (WebCore::ServiceWorkerContainer::getRegistrations):
2953         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
2954         (WebCore::ServiceWorkerContainer::stop):
2955         * workers/service/ServiceWorkerContainer.h:
2956
2957 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
2958
2959         Cleanup code that computes iframe content offsets in FrameView
2960         https://bugs.webkit.org/show_bug.cgi?id=180385
2961
2962         Reviewed by Zalan Bujtas.
2963
2964         The coordinate conversion functions in FrameView explicitly added borderLeft/paddingLeft
2965         and borderTop/paddingTop to compute the offset from the contents of a frame to its parent renderer.
2966         
2967         This is equivalent to the call to contextBoxRect() that RenderWidget::updateWidgetGeometry() does,
2968         which also takes left-side scrollbars into account.
2969         
2970         Coordinate offsets don't need height and width, so add RenderBox::contentBoxLocation() that just
2971         computes the top left, and use it in FrameView.
2972
2973         * page/FrameView.cpp:
2974         (WebCore::FrameView::invalidateRect):
2975         (WebCore::FrameView::convertToContainingView const):
2976         (WebCore::FrameView::convertFromContainingView const):
2977         * platform/graphics/FloatPoint.h:
2978         (WebCore::FloatPoint::scaled const):
2979         (WebCore::FloatPoint::scaled): Deleted.
2980         * rendering/RenderBox.cpp:
2981         (WebCore::RenderBox::contentBoxLocation const):
2982         * rendering/RenderBox.h:
2983
2984 2017-12-04  Nan Wang  <n_wang@apple.com>
2985
2986         AX: AOM: Implement relation type properties
2987         https://bugs.webkit.org/show_bug.cgi?id=179500
2988
2989         Reviewed by Ryosuke Niwa.
2990
2991         Accessibility Object Model
2992         Explainer: https://wicg.github.io/aom/explainer.html
2993         Spec: https://wicg.github.io/aom/spec/
2994
2995         Implemented the AOM support for activeDescendant, details and errorMessage.
2996         The corresponding ARIA attributes all take IDREFs, and the AOM properties
2997         take references to AccessibleNodes instead.
2998
2999         Test: accessibility/mac/AOM-relation-property.html
3000
3001         * accessibility/AccessibilityObject.cpp:
3002         (WebCore::AccessibilityObject::getAttribute const):
3003         (WebCore::AccessibilityObject::hasProperty const):
3004         (WebCore::AccessibilityObject::stringValueForProperty const):
3005         (WebCore::AccessibilityObject::boolValueForProperty const):
3006         (WebCore::AccessibilityObject::intValueForProperty const):
3007         (WebCore::AccessibilityObject::unsignedValueForProperty const):
3008         (WebCore::AccessibilityObject::doubleValueForProperty const):
3009         (WebCore::AccessibilityObject::elementValueForProperty const):
3010         (WebCore::AccessibilityObject::supportsARIAAttributes const):
3011         (WebCore::AccessibilityObject::elementsFromProperty const):
3012         (WebCore::AccessibilityObject::elementsReferencedByProperty const):
3013         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
3014         (WebCore::AccessibilityObject::ariaDetailsElements const):
3015         (WebCore::AccessibilityObject::ariaDetailsReferencingElements const):
3016         (WebCore::AccessibilityObject::ariaErrorMessageElements const):
3017         (WebCore::AccessibilityObject::ariaErrorMessageReferencingElements const):
3018         * accessibility/AccessibilityObject.h:
3019         * accessibility/AccessibilityRenderObject.cpp:
3020         (WebCore::AccessibilityRenderObject::activeDescendant const):
3021         * accessibility/AccessibleNode.cpp:
3022         (WebCore::ariaAttributeMap):
3023         (WebCore::isPropertyValueRelation):
3024         (WebCore::AccessibleNode::attributeFromAXPropertyName):
3025         (WebCore::AccessibleNode::setRelationProperty):
3026         (WebCore::AccessibleNode::singleRelationValueForProperty):
3027         (WebCore::AccessibleNode::activeDescendant const):
3028         (WebCore::AccessibleNode::setActiveDescendant):
3029         (WebCore::AccessibleNode::details const):
3030         (WebCore::AccessibleNode::setDetails):
3031         (WebCore::AccessibleNode::errorMessage const):
3032         (WebCore::AccessibleNode::setErrorMessage):
3033         * accessibility/AccessibleNode.h:
3034         * accessibility/AccessibleNode.idl:
3035         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3036         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3037
3038 2017-12-04  Simon Fraser  <simon.fraser@apple.com>
3039
3040         Minor DisplayRefreshMonitor-related cleanup
3041         https://bugs.webkit.org/show_bug.cgi?id=179802
3042
3043         Reviewed by Sam Weinig.
3044
3045         New trace point for when the CVDisplayLink fires on its own thread.
3046
3047         Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
3048
3049         * inspector/agents/InspectorTimelineAgent.cpp:
3050         (WebCore::InspectorTimelineAgent::internalStart):
3051         * platform/cf/RunLoopObserver.h:
3052         * platform/graphics/DisplayRefreshMonitor.cpp:
3053         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
3054         * platform/graphics/ca/LayerFlushScheduler.h:
3055         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
3056         (WebCore::LayerFlushScheduler::LayerFlushScheduler):
3057
3058 2017-12-04  David Quesada  <david_quesada@apple.com>
3059
3060         Add a class for parsing application manifests
3061         https://bugs.webkit.org/show_bug.cgi?id=177973
3062         rdar://problem/34747949
3063
3064         Reviewed by Geoffrey Garen.
3065
3066         Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
3067         ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
3068         of the manifests's properties are implemented to start with.
3069
3070         ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.
3071
3072         * Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
3073         * Modules/applicationmanifest/ApplicationManifest.h: Added.
3074         * Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
3075         (WebCore::ApplicationManifestParser::parse):
3076         The main entry point for eventual clients (and currently the unit tests) to invoke
3077         ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
3078         uses the context exclusively for logging console warnings while parsing the manifest, and
3079         not for actually executing any scripts.
3080         (WebCore::ApplicationManifestParser::ApplicationManifestParser):
3081         (WebCore::ApplicationManifestParser::parseManifest):
3082         (WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
3083         (WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
3084         (WebCore::ApplicationManifestParser::logDeveloperWarning):
3085         (WebCore::ApplicationManifestParser::parseStartURL):
3086         (WebCore::ApplicationManifestParser::parseName):
3087         (WebCore::ApplicationManifestParser::parseDescription):
3088         (WebCore::ApplicationManifestParser::parseShortName):
3089         (WebCore::isInScope):
3090         (WebCore::ApplicationManifestParser::parseScope):
3091         (WebCore::ApplicationManifestParser::parseGenericString):
3092         * Modules/applicationmanifest/ApplicationManifestParser.h: Added.
3093         * Sources.txt:
3094         * WebCore.xcodeproj/project.pbxproj:
3095         * features.json: Change the Web App Manifest feature status to "In Development"
3096
3097 2017-12-04  Zalan Bujtas  <zalan@apple.com>
3098
3099         RenderMultiColumnFlow::fragmentedFlowDescendantInserted should not destroy incoming newDescendant
3100         https://bugs.webkit.org/show_bug.cgi?id=180181
3101
3102         Reviewed by Antti Koivisto.
3103
3104         This is in preparation for having all multicolumn related tree mutation in RenderTreeUpdaterMultiColumn.
3105
3106         Covered by fast/multicol/column-span-range-crash.html
3107
3108         * rendering/RenderMultiColumnFlow.cpp:
3109         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
3110         * rendering/RenderMultiColumnFlow.h:
3111         * style/RenderTreeUpdaterMultiColumn.cpp:
3112         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
3113
3114 2017-12-04  JF Bastien  <jfbastien@apple.com>
3115
3116         Update std::expected to match libc++ coding style
3117         https://bugs.webkit.org/show_bug.cgi?id=180264
3118
3119         Reviewed by Alex Christensen.
3120
3121         Update various uses of Expected, mostly renaming valueOr and
3122         hasValue to the STL naming convention.
3123
3124         * Modules/cache/DOMCache.cpp:
3125         (WebCore::DOMCache::retrieveRecords):
3126         (WebCore::DOMCache::batchDeleteOperation):
3127         (WebCore::DOMCache::batchPutOperation):
3128         * Modules/cache/DOMCacheStorage.cpp:
3129         (WebCore::DOMCacheStorage::retrieveCaches):
3130         (WebCore::DOMCacheStorage::open):
3131         (WebCore::DOMCacheStorage::remove):
3132         * Modules/cache/WorkerCacheStorageConnection.cpp:
3133         (WebCore::WorkerCacheStorageConnection::doRemove):
3134         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3135         (WebCore::recordsDataOrErrorFromRecords):
3136         (WebCore::recordsOrErrorFromRecordsData):
3137         * bindings/js/CachedScriptFetcher.cpp:
3138         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
3139         * contentextensions/ContentExtensionCompiler.cpp:
3140         (WebCore::ContentExtensions::compileRuleList):
3141         * contentextensions/ContentExtensionParser.cpp:
3142         (WebCore::ContentExtensions::getDomainList):
3143         (WebCore::ContentExtensions::loadTrigger):
3144         (WebCore::ContentExtensions::loadRule):
3145         (WebCore::ContentExtensions::loadEncodedRules):
3146         (WebCore::ContentExtensions::parseRuleList):
3147         * css/CSSFontFaceSrcValue.cpp:
3148         (WebCore::CSSFontFaceSrcValue::cachedFont):
3149         * css/CSSImageSetValue.cpp:
3150         (WebCore::CSSImageSetValue::loadBestFitImage):
3151         * css/CSSImageValue.cpp:
3152         (WebCore::CSSImageValue::loadImage):
3153         * css/StyleRuleImport.cpp:
3154         (WebCore::StyleRuleImport::requestStyleSheet):
3155         * dom/CallbackResult.h:
3156         (WebCore::CallbackResult<ReturnType>::type const):
3157         (WebCore::CallbackResult<ReturnType>::releaseReturnValue):
3158         * dom/Element.cpp:
3159         (WebCore::Element::getIntegralAttribute const):
3160         (WebCore::Element::getUnsignedIntegralAttribute const):
3161         * dom/ExceptionOr.h:
3162         (WebCore::ExceptionOr<ReturnType>::hasException const):
3163         (WebCore::ExceptionOr<void>::hasException const):
3164         * dom/ProcessingInstruction.cpp:
3165         (WebCore::ProcessingInstruction::checkStyleSheet):
3166         * html/HTMLInputElement.cpp:
3167         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
3168         (WebCore::HTMLInputElement::minLengthAttributeChanged):
3169         * html/HTMLLinkElement.cpp:
3170         (WebCore::HTMLLinkElement::process):
3171         * html/HTMLTextAreaElement.cpp:
3172         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
3173         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
3174         * html/parser/HTMLParserIdioms.cpp:
3175         (WebCore::parseHTMLNonNegativeInteger):
3176         * html/parser/HTMLParserIdioms.h:
3177         (WebCore::limitToOnlyHTMLNonNegative):
3178         * loader/CrossOriginPreflightChecker.cpp:
3179         (WebCore::CrossOriginPreflightChecker::startPreflight):
3180         * loader/DocumentLoader.cpp:
3181         (WebCore::DocumentLoader::loadMainResource):
3182         * loader/DocumentThreadableLoader.cpp:
3183         (WebCore::DocumentThreadableLoader::loadRequest):
3184         * loader/ImageLoader.cpp:
3185         (WebCore::ImageLoader::updateFromElement):
3186         * loader/LinkLoader.cpp:
3187         (WebCore::LinkLoader::preloadIfNeeded):
3188         (WebCore::LinkLoader::loadLink):
3189         * loader/MediaResourceLoader.cpp:
3190         (WebCore::MediaResourceLoader::requestResource):
3191         * loader/TextTrackLoader.cpp:
3192         (WebCore::TextTrackLoader::load):
3193         * loader/cache/CachedSVGDocumentReference.cpp:
3194         (WebCore::CachedSVGDocumentReference::load):
3195         * loader/icon/IconLoader.cpp:
3196         (WebCore::IconLoader::startLoading):
3197         * platform/URLParser.cpp:
3198         (WebCore::URLParser::parseIPv4Host):
3199         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
3200         (WebCore::WebCoreAVCFResourceLoader::startLoading):
3201         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3202         (WebCore::WebCoreAVFResourceLoader::startLoading):
3203         * svg/SVGFEImageElement.cpp:
3204         (WebCore::SVGFEImageElement::requestImageResource):
3205         * svg/SVGFontFaceUriElement.cpp:
3206         (WebCore::SVGFontFaceUriElement::loadFont):
3207         * svg/SVGUseElement.cpp:
3208         (WebCore::SVGUseElement::updateExternalDocument):
3209         * xml/XSLImportRule.cpp:
3210         (WebCore::XSLImportRule::loadSheet):
3211
3212 2017-12-04  Zalan Bujtas  <zalan@apple.com>
3213
3214         REGRESSION (r211531): Text flow changes and overlaps other text after double-click selecting paragraph
3215         https://bugs.webkit.org/show_bug.cgi?id=180377
3216         <rdar://problem/34337967>
3217
3218         Reviewed by Antti Koivisto.
3219
3220         Take floats into account when computing the available width for a certain vertical position.
3221
3222         Test: fast/block/float/simple-line-layout-float-shrink-line.html
3223
3224         * rendering/SimpleLineLayout.cpp:
3225         (WebCore::SimpleLineLayout::updateLineConstrains):
3226
3227 2017-12-04  Antoine Quint  <graouts@apple.com>
3228
3229         <video> and scale() transforms yield shrunk small or clipped controls
3230         https://bugs.webkit.org/show_bug.cgi?id=180358
3231         <rdar://problem/34436124>
3232
3233         Reviewed by Dean Jackson.
3234
3235         To compute the bounds of the media controls, we would call getBoundingClientRect()
3236         on the root-most element in the shadow root, which is styled to have width and height
3237         set to 100%, which allows to match the metrics of the host media element, without
3238         the borders.
3239
3240         However, if the host media element has CSS transforms applied, these would be factored
3241         into calls to getBoundingClientRect() and the controls would be too large and clipped,
3242         in case the scale was more than 1, or shrunk, in case the scale was less than 1.
3243
3244         To obtain correct metrics, we computed the complete transformation matrix applied to
3245         the host media element, and apply its inverted matrix to each corner point of the
3246         bounds returned for the root-most container element in the shadow root.
3247
3248         Then we compute the width and height of this transformed rectangle and set those to
3249         be our media controls' metrics.
3250
3251         Test: media/modern-media-controls/css/transformed-media.html
3252
3253         * Modules/modern-media-controls/media/media-controller.js:
3254         (MediaController.prototype._updateControlsSize):
3255         (MediaController.prototype._controlsWidth): Deleted.
3256
3257 2017-12-04  Antoine Quint  <graouts@apple.com>
3258
3259         Cursor is not visible after exiting full screen video
3260         https://bugs.webkit.org/show_bug.cgi?id=180247
3261         <rdar://problem/33885922>
3262
3263         Reviewed by Dean Jackson.
3264
3265         There is a dedicated NSCursor method to temporarily hide the mouse cursor while the mouse is idle,
3266         so we use this platform functionality, already exposed through the page chrome, instead which
3267         implements the expected behavior. Now, the mouse cursor is hidden while the mouse is stationary
3268         when a <video> is fullscreen, as before, but as soon as the user exits fullscreen, the mouse cursor
3269         reappears.
3270
3271         No test provided as I don't believe this platform behavior can be tested, there is no API to query
3272         whether the cursor is visible.
3273
3274         * page/EventHandler.cpp:
3275         (WebCore::EventHandler::cancelAutoHideCursorTimer):
3276         (WebCore::EventHandler::autoHideCursorTimerFired):
3277
3278 2017-12-04  Chris Dumez  <cdumez@apple.com>
3279
3280         ServiceWorkerGlobalScope::skipWaiting(Ref<DeferredPromise>&&) is unsafe
3281         https://bugs.webkit.org/show_bug.cgi?id=180372
3282
3283         Reviewed by Youenn Fablet.
3284
3285         Ref the WorkerThread and capture it in the lambda. Keep the pending promises in
3286         a HashMap on the ServiceWorkerGlobalScope so that they stay on the worker thread.
3287
3288         * workers/service/ServiceWorkerGlobalScope.cpp:
3289         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
3290         * workers/service/ServiceWorkerGlobalScope.h:
3291
3292 2017-12-04  Brady Eidson  <beidson@apple.com>
3293
3294         Get a directory path to SWServers for storing ServiceWorker registrations.
3295         https://bugs.webkit.org/show_bug.cgi?id=180362
3296
3297         Reviewed by Chris Dumez.
3298
3299         No new tests (No observable behavior change yet).
3300
3301         * workers/service/server/SWServer.cpp:
3302         (WebCore::SWServer::SWServer):
3303         * workers/service/server/SWServer.h:
3304
3305 2017-12-04  Devin Rousso  <webkit@devinrousso.com>
3306
3307         Web Inspector: provide method for recording CanvasRenderingContext2D from JavaScript
3308         https://bugs.webkit.org/show_bug.cgi?id=175166
3309         <rdar://problem/34040740>
3310
3311         Reviewed by Joseph Pecoraro.
3312
3313         No new tests, updated existing tests.
3314
3315         * inspector/InspectorCanvas.h:
3316         * inspector/InspectorCanvas.cpp:
3317         (WebCore::InspectorCanvas::resetRecordingData):
3318
3319         * inspector/InspectorCanvasAgent.h:
3320         * inspector/InspectorCanvasAgent.cpp:
3321         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3322         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3323
3324         * inspector/InspectorInstrumentation.h:
3325         * inspector/InspectorInstrumentation.cpp:
3326         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3327         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3328
3329         * page/PageConsoleClient.h:
3330         * page/PageConsoleClient.cpp:
3331         (WebCore::PageConsoleClient::record):
3332         (WebCore::PageConsoleClient::recordEnd):
3333
3334         * workers/WorkerConsoleClient.h:
3335         * workers/WorkerConsoleClient.cpp:
3336         (WebCore::WorkerConsoleClient::record):
3337         (WebCore::WorkerConsoleClient::recordEnd):
3338
3339 2017-12-04  Youenn Fablet  <youenn@apple.com>
3340
3341         Call "Terminate Service Worker" on all workers when all their clients are gone
3342         https://bugs.webkit.org/show_bug.cgi?id=179552
3343
3344         Reviewed by Chris Dumez.
3345
3346         Tested manually.
3347
3348         When SWServer detects that there is no longer any client for a given client origin,
3349         it iterates through the running workers to terminate them if they have the given client origin.
3350         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.
3351
3352         * workers/service/server/SWServer.cpp:
3353         (WebCore::SWServer::findClientByIdentifier):
3354         (WebCore::SWServer::matchAll):
3355         (WebCore::SWServer::registerServiceWorkerClient):
3356         (WebCore::SWServer::unregisterServiceWorkerClient):
3357         * workers/service/server/SWServer.h:
3358
3359 2017-12-04  Antti Koivisto  <antti@apple.com>
3360
3361         Enable selector filtering for ::before and ::after pseudo element resolution
3362         https://bugs.webkit.org/show_bug.cgi?id=180364
3363
3364         Reviewed by Ryosuke Niwa.
3365
3366         Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
3367
3368         This is 10%+ progression in StyleBench pseudo element subtest.
3369
3370         * css/StyleResolver.cpp:
3371         (WebCore::StyleResolver::pseudoStyleForElement):
3372         * css/StyleResolver.h:
3373         * style/StyleTreeResolver.cpp:
3374         (WebCore::Style::TreeResolver::resolvePseudoStyle):
3375
3376 2017-12-04  Youenn Fablet  <youenn@apple.com>
3377
3378         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
3379         https://bugs.webkit.org/show_bug.cgi?id=180359
3380
3381         Reviewed by Chris Dumez.
3382
3383         This algorithm is needed for implementation of claim.
3384         As per specification, it is run for every client unload, hence why this is put in removeClientUsingRegistration.
3385
3386         * workers/service/server/SWServerRegistration.cpp:
3387         (WebCore::SWServerRegistration::removeClientUsingRegistration):
3388         (WebCore::SWServerRegistration::handleClientUnload):
3389         * workers/service/server/SWServerRegistration.h:
3390
3391 2017-12-04  Antti Koivisto  <antti@apple.com>
3392
3393         Remove duplicates from selector filter hashes
3394         https://bugs.webkit.org/show_bug.cgi?id=180354
3395
3396         Reviewed by Simon Fraser.
3397
3398         We have only four slots for hashes in RuleSet and adding more regresses performance. To use the limited slots
3399         better we should eliminate duplicates.
3400
3401         This patch also switches to using std::array instead of a C array for the hashes.
3402
3403         The patch reduces the number of selectors passing through the selector filter in StyleBench by ~0.4%.
3404
3405         * css/ElementRuleCollector.cpp:
3406         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
3407         * css/RuleSet.cpp:
3408         (WebCore::RuleData::RuleData):
3409         * css/RuleSet.h:
3410         (WebCore::RuleData::descendantSelectorIdentifierHashes const):
3411         * css/SelectorFilter.cpp:
3412         (WebCore::collectDescendantSelectorIdentifierHashes):
3413         (WebCore::SelectorFilter::collectIdentifierHashes):
3414         * css/SelectorFilter.h:
3415         (WebCore::SelectorFilter::fastRejectSelector const):
3416
3417 2017-12-04  Youenn Fablet  <youenn@apple.com>
3418
3419         WorkerCacheStorageConnection should handle the case of terminated workers
3420         https://bugs.webkit.org/show_bug.cgi?id=180304
3421
3422         Reviewed by Chris Dumez.
3423
3424         No web page observable change of behavior.
3425
3426         Reworked WorkerCacheStorageConnection hopping.
3427         Instead of refing/unrefing itself, it refs the worker thread and the main thread connection.
3428         This worker thread is then used on the way back from the main thread.
3429