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