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