[QuickLook] Use case-insensitive comparison of preview MIME types
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-09  Andy Estes  <aestes@apple.com>
2
3         [QuickLook] Use case-insensitive comparison of preview MIME types
4         https://bugs.webkit.org/show_bug.cgi?id=175350
5         <rdar://problem/33761159>
6
7         Reviewed by Brady Eidson.
8
9         MIME types are case-insensitive, but PreviewLoader was using a case-sensitive comparison to
10         determine if a MIME type was supported by QLPreviewConverter. As a result we would fail to
11         preview Excel macro-enabled workbooks, since CFNetwork would sniff a MIME type of
12         "application/vnd.ms-excel.sheet.macroEnabled.12" but QuickLook contained
13         "application/vnd.ms-excel.sheet.macroenabled.12" in its set of supported MIME type strings.
14
15         Fix this by copying the QuickLook supported MIME type set into a HashSet using
16         ASCIICaseInsensitiveHash and using that HashSet for MIME type checks.
17
18         Test: quicklook/excel-macro-enabled.html
19
20         * loader/ios/PreviewLoader.mm:
21         (WebCore::PreviewLoader::shouldCreateForMIMEType):
22
23 2017-08-09  Ms2ger  <Ms2ger@igalia.com>
24
25         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions
26         https://bugs.webkit.org/show_bug.cgi?id=175375
27
28         Reviewed by Sam Weinig.
29
30         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions.
31
32         These should have been removed in r207688.
33
34         No new tests: no behavior change.
35
36         * platform/audio/PlatformMediaSessionManager.cpp:
37         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const):
38         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
39         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const):
40         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const):
41
42 2017-08-09  Chris Dumez  <cdumez@apple.com>
43
44         Reinstate active flag for iterators
45         https://bugs.webkit.org/show_bug.cgi?id=175312
46
47         Reviewed by Sam Weinig.
48
49         NodeIterator / TreeWalker should no longer allow recursive filters
50         after the following change to the DOM specification:
51         - https://github.com/whatwg/dom/pull/359
52
53         This patch aligns our behavior with the latest specification.
54
55         No new tests, updated existing tests.
56
57         * dom/NodeIterator.cpp:
58         (WebCore::NodeIterator::nextNode):
59         (WebCore::NodeIterator::previousNode):
60         Note that we now also call m_candidateNode.clear() before returning an
61         exception. This was a pre-existing bug that we failed to do so in the
62         exception case but it became more obvious after this change now that
63         we throw. This was causing traversal/moz-bug559526.html to fail
64         otherwise (the filter was called one too many times). The test case
65         is passing in Firefox (The filter is called 4 times and they throw
66         each time).
67
68         * dom/Traversal.cpp:
69         (WebCore::NodeIteratorBase::NodeIteratorBase):
70         (WebCore::NodeIteratorBase::acceptNode):
71         * dom/Traversal.h:
72         * dom/TreeWalker.cpp:
73
74 2017-08-09  Antti Koivisto  <antti@apple.com>
75
76         RenderQuote should not mutate render tree
77         https://bugs.webkit.org/show_bug.cgi?id=175328
78
79         Reviewed by Zalan Bujtas.
80
81         RenderQuote text renderers are currently created and deleted in a quirky fashion using a linked list.
82         This patch moves to a simpler model that guarantees the mutations are always done in controlled fashion
83         during render tree update.
84
85         * dom/Document.cpp:
86         (WebCore::Document::updateTextRenderer):
87
88             Move text renderer updating to Document so we can set the inRenderTreeUpdate bit for it too.
89
90         * dom/Document.h:
91         * dom/Text.cpp:
92         (WebCore::Text::updateRendererAfterContentChange):
93         * rendering/RenderDescendantIterator.h:
94         (WebCore::RenderDescendantIteratorAdapter<T>::at):
95         (WebCore::RenderDescendantConstIteratorAdapter<T>::at const):
96
97             Add at() function for starting iteration from a specified renderer.
98
99         * rendering/RenderQuote.cpp:
100         (WebCore::RenderQuote::insertedIntoTree):
101         (WebCore::RenderQuote::willBeRemovedFromTree):
102
103             Register and unregister quotes to RenderView.
104             Don't do any mutations.
105
106         (WebCore::RenderQuote::styleDidChange):
107
108             Invalidate the text renderer but don't mutate it.
109
110         (WebCore::RenderQuote::updateTextRenderer):
111         (WebCore::RenderQuote::computeText const):
112         (WebCore::RenderQuote::updateRenderers):
113
114             Compute depth of all render quotes and update the text renderer as needed.
115
116         (WebCore::RenderQuote::willBeDestroyed): Deleted.
117         (WebCore::RenderQuote::attachQuote): Deleted.
118         (WebCore::RenderQuote::detachQuote): Deleted.
119         (WebCore::RenderQuote::updateDepth): Deleted.
120
121             Get rid of the linked list.
122
123         * rendering/RenderQuote.h:
124         * rendering/RenderView.cpp:
125         (WebCore::RenderView::registerQuote):
126         (WebCore::RenderView::unregisterQuote):
127
128             Maintain a render tree order ListHashSet of RenderQuotes.
129
130         (WebCore::RenderView::updateSpecialRenderers):
131
132             Add a function for making additional render tree mutations at the end of a render tree update.
133             Currently this just invokes RenderQuote::updateRenderers.
134
135         * rendering/RenderView.h:
136         * style/RenderTreeUpdater.cpp:
137         (WebCore::RenderTreeUpdater::commit):
138
139             Call RenderView::updateSpecialRenderers after committing all other changes.
140
141 2017-08-09  Zan Dobersek  <zdobersek@igalia.com>
142
143         [Soup] Incorrect conversion in msToSoupDate()
144         https://bugs.webkit.org/show_bug.cgi?id=175320
145
146         Reviewed by Carlos Garcia Campos.
147
148         Original patch by VaL Doroshchuk.
149
150         * platform/network/soup/NetworkStorageSessionSoup.cpp:
151         (WebCore::msToSoupDate): monthFromDayInYear() returns a value in the [0,11] range,
152         while soup_date_new() expects a month value in the [1,12] range. The return value
153         must be thus incremented by one to match that expectation.
154
155 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
156
157         Unreviewed, rolling out r220393.
158
159         This patch regresses the performance of WebPage::editorState.
160
161         Reverted changeset:
162
163         "[iOS WK2] WKWebView schedules nonstop layout after pressing
164         cmb+b,i,u inside a contenteditable div"
165         https://bugs.webkit.org/show_bug.cgi?id=175116
166         http://trac.webkit.org/changeset/220393
167
168 2017-08-08  Chris Dumez  <cdumez@apple.com>
169
170         [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
171         https://bugs.webkit.org/show_bug.cgi?id=175264
172         <rdar://problem/33547793>
173
174         Reviewed by Youenn Fablet.
175
176         Pass additional information when creating a PingHandle so that the PingLoad
177         can deal with CORS-preflighting on Network process side.
178
179         Tests: http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
180                http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
181                http/wpt/beacon/cors/cors-preflight-blob-failure.html
182                http/wpt/beacon/cors/cors-preflight-blob-success.html
183                http/wpt/beacon/cors/cors-preflight-cookie.html
184
185         * WebCore.xcodeproj/project.pbxproj:
186         * loader/CrossOriginAccessControl.cpp:
187         (WebCore::validatePreflightResponse):
188         * loader/CrossOriginAccessControl.h:
189         * loader/CrossOriginPreflightChecker.cpp:
190         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
191         * loader/CrossOriginPreflightResultCache.h:
192         * loader/LoaderStrategy.h:
193         * loader/PingLoader.cpp:
194         (WebCore::PingLoader::loadImage):
195         (WebCore::PingLoader::sendPing):
196         (WebCore::PingLoader::sendViolationReport):
197         (WebCore::PingLoader::startPingLoad):
198         * loader/PingLoader.h:
199         * loader/cache/CachedResource.cpp:
200         (WebCore::CachedResource::load):
201         * page/SecurityOrigin.h:
202
203 2017-08-08  Sam Weinig  <sam@webkit.org>
204
205         Address review feedback from https://bugs.webkit.org/show_bug.cgi?id=175246.
206
207         * bindings/js/DOMPromiseProxy.h:
208         * css/FontFaceSet.cpp:
209         * css/FontFaceSet.h:
210
211 2017-08-08  Devin Rousso  <drousso@apple.com>
212
213         Web Inspector: Canvas: support editing WebGL shaders
214         https://bugs.webkit.org/show_bug.cgi?id=124211
215         <rdar://problem/15448958>
216
217         Reviewed by Matt Baker.
218
219         Test: inspector/canvas/updateShader.html
220
221         * inspector/InspectorCanvasAgent.h:
222         * inspector/InspectorCanvasAgent.cpp:
223         (WebCore::InspectorCanvasAgent::updateShader):
224
225         * html/canvas/WebGLRenderingContextBase.h:
226         * html/canvas/WebGLRenderingContextBase.cpp:
227         (WebCore::WebGLRenderingContextBase::linkProgram):
228         (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
229         Normally, when a program is linked, it invalidates any WebGLUniformLocation associated with
230         the program by incrementing its `linkCount`. In order to allow live editing of shaders, we
231         need to be able to compile and link a shader without invalidating these locations. This
232         patch moves the shader linking logic to its own function that is called by `linkProgram` so
233         that InspectorCanvasAgent can compile and link without invalidation.
234
235 2017-08-08  Sam Weinig  <sam@webkit.org>
236
237         [WebIDL] Add support for Promise<> attributes
238         https://bugs.webkit.org/show_bug.cgi?id=175246
239
240         Reviewed by Yusuke Suzuki.
241
242         Introduces and adopts DOMPromiseProxy, a new class for binding promises in a more
243         straightforward and safe (from a wrapper world perspective) way.
244
245         * CMakeLists.txt:
246         * WebCore.xcodeproj/project.pbxproj:
247         * bindings/js/JSFontFaceCustom.cpp: Removed.
248         * bindings/js/JSFontFaceSetCustom.cpp: Removed.
249         * bindings/js/JSMediaKeySessionCustom.cpp: Removed.
250         * bindings/js/JSServiceWorkerContainerCustom.cpp: Removed.
251         * bindings/js/JSWebGPUCommandBufferCustom.cpp: Removed.
252
253             Remove custom bindings only needed for promise attributes. Add DOMPromiseProxy.h
254
255         * Modules/encryptedmedia/MediaKeySession.cpp:
256         (WebCore::MediaKeySession::sessionClosed):
257         (WebCore::MediaKeySession::registerClosedPromise): Deleted.
258         * Modules/encryptedmedia/MediaKeySession.h:
259         * Modules/encryptedmedia/MediaKeySession.idl:
260
261             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
262
263         * bindings/IDLTypes.h:
264
265             Add StorageType type alias to allow specifying a specific form for storage. This allows
266             use to use Ref<> for interfaces in DOMPromiseProxy.
267
268         (WebCore::IDLWrapper::convertToParameterType):
269             
270             Also add convertToParameterType, an annoying hack to workaround the fact WTF::Function
271             can't return references / no
272
273         * bindings/js/DOMPromiseProxy.h: Added.
274         (WebCore::DOMPromiseProxy<IDLType>):
275         
276             DOMPromiseProxy is a new class (set of classes) to represent promises that works with the 
277             standard toJS<> / JSDOMConvert infrastructure used by the bindings generator. From the
278             implementation perspective, it is similar to DOMPromiseDeferred, but instead of receiving
279             one as a parameter, you can initialize it directly in your constructor and start using it.
280
281             From the bindings perspective, a DOMPromiseProxy can be converted into a JS Promise by calling
282             its promise function, which will either create a new promise, or return a cached one.
283
284             To make this work, DOMPromiseProxy maintains a Vector of DeferredPromises that hold onto those
285             actualized promises. The reason it has a Vector, is that we need one DeferredPromises per
286             DOMWrapperWorld, just like we need one wrapper for an interface per DOMWrapperWorld in the 
287             wrapper cache. In most cases, only the normal world will be in play, so the Vector has an inline
288             capacity of one.
289             
290             In addition, DOMPromiseProxy maintains a Variant of either an Exception or the result value type.
291             This allows the DOMPromiseProxy to be resolved or rejected at anytime. Then, when the bindings
292             request the promise, the stored result / exception can be resolved / rejected into the promise.
293
294         (WebCore::DOMPromiseProxy<IDLVoid>):
295
296             For void promises, we need slightly different semantics (resolve takes no parameters, Value is
297             a bit indicating resolved state), so it is specialized.
298
299         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>):
300
301             In addition to the void specialization, we have DOMPromiseProxyWithResolveCallback. Instead of
302             storing the value of the resolution directly, this specialization allows the owner to specify
303             callback to be called when the resolved value is needed. This is needed to avoid reference
304             cycles when the resolved value is the owner such as is the case with FontFace and FontFaceSet.
305
306         * bindings/js/JSDOMConvertPromise.h:
307         (WebCore::JSConverter<IDLPromise<T>>::convert):
308         Add converter that calls through to the DOMPromiseProxy function promise.
309
310         * bindings/js/JSDOMPromiseDeferred.cpp:
311         (WebCore::DeferredPromise::callFunction):
312         (WebCore::DeferredPromise::reject):
313         * bindings/js/JSDOMPromiseDeferred.h:
314         (WebCore::DeferredPromise::create):
315         (WebCore::DeferredPromise::DeferredPromise):
316
317             Add a new create function for DeferredPromise that creates the JSPromiseDeferred for you.
318             Also adds a mode to DeferredPromise to allow keeping the promise after resolution. Maintain
319             the old behavior as the default.
320
321             Change reject to take an Exception as sink rather than an r-value, to allow DOMPromiseProxy
322             to copy a Exception into multiple DeferredPromises. For callers already moving into reject,
323             this should be no change.
324
325         * bindings/scripts/CodeGeneratorJS.pm:
326         (AddToIncludesForIDLType):
327         (GenerateParametersCheck):
328         (GenerateImplementationFunctionCall):
329         (NativeToJSValueDOMConvertNeedsState):
330         (NativeToJSValueDOMConvertNeedsGlobalObject):
331
332             Add support DOMPromiseProxy. For now, this means a new extended attribute, [PromiseProxy],
333             but once I convert all the existing promises over to using DOMPromiseProxy, it will be removed.
334             
335             Also specify the right #includes for promises and necessary parameters for conversion.
336
337         * bindings/scripts/IDLAttributes.json:
338         
339             Add [PromiseProxy], a temporary extended attribute for using DOMPromiseProxy.
340
341         * css/FontFace.cpp:
342         * css/FontFace.h:
343         * css/FontFace.idl:
344         * css/FontFaceSet.cpp:
345         * css/FontFaceSet.h:
346         * css/FontFaceSet.idl:
347
348             Replace custom promise code using the registerPromise idiom with DOMPromiseProxyWithResolveCallback.
349             The callback is necessary for these two classes since the value the resolve is themselves, and using
350             a normal resolve would create a cycle.
351
352         * html/canvas/WebGPUCommandBuffer.cpp:
353         * html/canvas/WebGPUCommandBuffer.h:
354         * html/canvas/WebGPUCommandBuffer.idl:
355         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
356         * platform/graphics/gpu/GPUCommandBuffer.cpp:
357         * platform/graphics/gpu/GPUCommandBuffer.h:
358
359             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
360
361         * page/NavigatorBase.cpp:
362         (WebCore::NavigatorBase::NavigatorBase):
363         * page/NavigatorBase.h:
364
365             Forward declare ServiceWorkerContainer and add an explicit constructor to allow
366             removing #include of ServiceWorkerContainer.h in the header, avoiding an #include cycle.
367
368         * workers/ServiceWorkerContainer.cpp:
369         * workers/ServiceWorkerContainer.h:
370         * workers/ServiceWorkerContainer.idl:
371
372             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
373
374         * bindings/scripts/test/JS/JSTestObj.cpp:
375         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
376         * bindings/scripts/test/TestObj.idl:
377
378             Add / update tests.
379
380 2017-08-08  John Wilander  <wilander@apple.com>
381
382         Resource Load Statistics: Merge of dataRecordsRemoved should use std::max()
383         https://bugs.webkit.org/show_bug.cgi?id=175348
384         <rdar://problem/33785695>
385
386         Reviewed by Chris Dumez.
387
388         No new tests. Online change of a statistic that doesn't affect logic flow.
389
390         * loader/ResourceLoadStatistics.cpp:
391         (WebCore::ResourceLoadStatistics::merge):
392             Now uses std::max() instead of addition.
393
394 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
395
396         Sandbox flags do not support document.domain control
397         https://bugs.webkit.org/show_bug.cgi?id=175281
398         <rdar://problem/33778936>
399
400         Reviewed by Chris Dumez.
401
402         Update the 'setDomain' logic to honor the sandbox properties as defined in the current
403         HTML5 specification. This brings us in line with how Chrome and other browsers have
404         worked for some time.
405
406         Test: fast/frames/sandboxed-iframe-domain.html
407
408         * dom/Document.cpp:
409         (WebCore::Document::setDomain): Add check for sandbox flag (with appropriate error message)
410         * dom/SecurityContext.h:
411
412 2017-08-08  Jeremy Jones  <jeremyj@apple.com>
413
414         Change fast seek logic to prevent ping-ponging.
415         https://bugs.webkit.org/show_bug.cgi?id=175167
416         rdar://problem/32936116
417
418         Reviewed by Jer Noble.
419
420         Updated test: media/video-fast-seek.html
421
422         Changed fast seek behavior to always seek early than seek time; and after current time when seeking forward.
423         This prevents ping-ponging, where a fast seek overshoots the target looking for a keyframe.
424         A subsequent seek will suddenly be on the other side of current time and
425         will search in the opposite direction for a key frame; repeat.
426
427         * html/HTMLMediaElement.cpp:
428         (WebCore::HTMLMediaElement::fastSeek):
429
430 2017-08-08  Ms2ger  <Ms2ger@igalia.com>
431
432         Unreviewed. Correct the function name in a debug message.
433         https://bugs.webkit.org/show_bug.cgi?id=175262
434
435         No new tests: debug logs are not tested.
436
437         * platform/audio/PlatformMediaSessionManager.cpp:
438         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
439
440 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
441
442         Unreviewed build fix after r220376.
443
444         Don't attempt to use isPublicSuffix when building without that
445         feature enabled.
446
447         * dom/Document.cpp:
448         (WebCore::Document::domainIsRegisterable const):
449
450 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
451
452         [CMake] Properly test if compiler supports compiler flags
453         https://bugs.webkit.org/show_bug.cgi?id=174490
454
455         Reviewed by Konstantin Tokarev.
456
457         * CMakeLists.txt:
458         * PlatformGTK.cmake:
459         * PlatformWPE.cmake:
460
461 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
462
463         [GStreamer] Don't use GraphicsContext3D in VideoTextureCoperGStreamer
464         https://bugs.webkit.org/show_bug.cgi?id=174774
465
466         Reviewed by Carlos Garcia Campos.
467
468         VideoTextureCoperGStreamer class creates a new GraphicsContext3D internally
469         that's used to render to whichever OpenGL context is current. Such usage
470         doesn't add anything to the user since there's no underlying offscreen-based
471         OpenGL context created, and instead all GraphicsContext3D calls are directly
472         translated to usual OpenGL API calls. We should avoid using GraphicsContext3D
473         in such cases and instead use direct OpenGL API calls.
474
475         This patch achieves that for the VideoTextureCoperGStreamer class. A
476         GraphicsContext3D object is still created because it's needed to construct an
477         instance of the TextureMapperShaderProgram class, but this will be removed as
478         soon as TextureMapperShaderProgram drops the GraphicsContext3D dependence.
479
480         No new tests -- no change in behavior.
481
482         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
483         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
484         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
485         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
486         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
487         (WebCore::VideoTextureCopierGStreamer::resultTexture):
488
489 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
490
491         [TexMap] Drop GC3D* type usage from TextureMapperPlatformLayer{Buffer,Proxy}
492         https://bugs.webkit.org/show_bug.cgi?id=175314
493
494         Reviewed by Carlos Garcia Campos.
495
496         Switch to using OpenGL types in the TextureMapperPlatformLayerBuffer and
497         TextureMapperPlatformLayerProxy classes, instead of the equivalent GC3D*
498         types provided in the GraphicsTypes3D.h header.
499
500         No new tests -- no change in behavior.
501
502         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
503         (WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
504         (WebCore::TextureMapperPlatformLayerBuffer::canReuseWithoutReset):
505         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
506         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
507         (WebCore::TextureMapperPlatformLayerProxy::getAvailableBuffer):
508         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
509
510 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
511
512         [TexMap] Don't use GraphicsContext3D in ClipStack
513         https://bugs.webkit.org/show_bug.cgi?id=174776
514
515         Reviewed by Carlos Garcia Campos.
516
517         Any GraphicsContext3D object that's passed to ClipStack methods is of the
518         render-to-current-context nature, meaning there's no internally owned GL
519         context that has to be properly handled and all calls are simply passed to
520         OpenGL APIs. We should drop such (non-)usage of GraphicsContext3D in favor
521         of direct OpenGL API invocations.
522
523         This patch covers TextureMapper's ClipStack. Call sites to the apply() and
524         applyIfNeeded() are modified to not pass a reference to any
525         GraphicsContext3D object. Internally, OpenGL API entrypoints and constants
526         are used instead of GraphicsContext3D invocations.
527
528         No new tests -- no change in behavior.
529
530         * platform/graphics/texmap/BitmapTextureGL.cpp:
531         (WebCore::BitmapTextureGL::clearIfNeeded):
532         (WebCore::BitmapTextureGL::bindAsSurface):
533         * platform/graphics/texmap/ClipStack.cpp:
534         (WebCore::ClipStack::apply):
535         (WebCore::ClipStack::applyIfNeeded):
536         * platform/graphics/texmap/ClipStack.h:
537         * platform/graphics/texmap/TextureMapperGL.cpp:
538         (WebCore::TextureMapperGL::bindDefaultSurface):
539         (WebCore::TextureMapperGL::beginScissorClip):
540         (WebCore::TextureMapperGL::beginClip):
541         (WebCore::TextureMapperGL::endClip):
542
543 2017-08-08  Javier Fernandez  <jfernandez@igalia.com>
544
545         Not possible to remove the 'li' element inside the table cell
546         https://bugs.webkit.org/show_bug.cgi?id=173148
547
548         Reviewed by Ryosuke Niwa.
549
550         We need to add a new case for breaking out empty list items when they are
551         at the start of an editable area. Since list items can be also inside
552         table cells, we need to consider this kind of elements as well.
553
554         Tests: editing/deleting/delete-list-items-in-table-cell-1.html
555                editing/deleting/delete-list-items-in-table-cell-2.html
556                editing/deleting/delete-list-items-in-table-cell-3.html
557                editing/deleting/delete-list-items-in-table-cell-4.html
558                editing/deleting/delete-list-items-in-table-cell-5.html
559                editing/deleting/delete-list-items-in-table-cell-6.html
560                editing/deleting/delete-list-items-in-table-cell-7.html
561                editing/deleting/delete-list-items-in-table-cell-8.html
562
563         * editing/TypingCommand.cpp:
564         (WebCore::TypingCommand::deleteKeyPressed):
565
566 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
567
568         [TexMap] Isolate the TextureMapperPlatformLayerProxyProvider class
569         https://bugs.webkit.org/show_bug.cgi?id=175316
570
571         Reviewed by Carlos Garcia Campos.
572
573         Move the TextureMapperPlatformLayerProxyProvider class (which is the type
574         aliased to PlatformLayer for threaded CoordGraphics) into its own header
575         file. This prevents including the TextureMapperPlatformLayerProxy.h header
576         file in MediaPlayerPrivateGStreamerBase.h, avoiding spilling OpenGL types
577         and function declarations before the GStreamer GL headers include them
578         later in the MediaPlayerPrivateGStreamerBase implementation file.
579
580         In the MediaPlayerPrivateGStreamerBase.h header file, only the new header
581         is included, and a forward declaration of the TextureMapperPlatformLayerProxy
582         class is used. proxy() and swapBuffersIfNeeded() methods are moved into
583         the implementation file to avoid requiring the full definition of the
584         TextureMapperPlatformLayerProxy class.
585
586         Similar is done for the TextureMapperGC3DPlatformLayer class and the
587         Cairo-specific implementation of the ImageBufferData class. The
588         CoordinatedGraphicsLayer implementation file also gains an include of the
589         TextureMapperPlatformLayerProxyProvider.h header since it requires the full
590         definition of that class.
591
592         No new tests -- no change in behavior.
593
594         * platform/graphics/cairo/ImageBufferCairo.cpp:
595         (WebCore::ImageBufferData::proxy const):
596         * platform/graphics/cairo/ImageBufferDataCairo.h:
597         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
598         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
599         (WebCore::MediaPlayerPrivateGStreamerBase::proxy const):
600         (WebCore::MediaPlayerPrivateGStreamerBase::swapBuffersIfNeeded):
601         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
602         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
603         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
604         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
605         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h: Added.
606         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
607
608 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
609
610         Unreviewed. Follow-up to r220392 that fixes build on configurations
611         that disable USE(GSTREAMER_GL).
612
613         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
614         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
615         When creating the BitmapTextureGL object, also provide an initialized
616         TextureMapperContextAttributes object.
617
618 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
619
620         [TexMap] Group GL header file inclusions in a single header file
621         https://bugs.webkit.org/show_bug.cgi?id=175313
622
623         Reviewed by Carlos Garcia Campos.
624
625         Add a helper header file to the TextureMapper subsystem that includes
626         the OpenGL headers, properly addressing the build configuration to
627         include headers as provided by either libepoxy, the OpenGL ES library,
628         or the OpenGL library.
629
630         TextureMapperContextAttributes implementation file is the only one
631         that can leverage the header at the moment, but more will follow.
632
633         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
634         * platform/graphics/texmap/TextureMapperGLHeaders.h: Copied from Source/WebCore/platform/graphics/texmap/TextureMapperContextAttributes.cpp.
635
636 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
637
638         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
639         https://bugs.webkit.org/show_bug.cgi?id=175116
640         <rdar://problem/28279301>
641
642         Reviewed by Darin Adler and Ryosuke Niwa.
643
644         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
645
646         Tests: EditorStateTests.TypingAttributesBold
647                EditorStateTests.TypingAttributesItalic
648                EditorStateTests.TypingAttributesUnderline
649                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
650                EditorStateTests.TypingAttributesTextAlignmentStartEnd
651                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
652                EditorStateTests.TypingAttributesTextColor
653                EditorStateTests.TypingAttributesMixedStyles
654                EditorStateTests.TypingAttributesLinkColor
655
656         * css/StyleProperties.cpp:
657         (WebCore::StyleProperties::propertyAsColor const):
658         (WebCore::StyleProperties::propertyAsValueID const):
659
660         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
661
662         * css/StyleProperties.h:
663         * editing/EditingStyle.cpp:
664         (WebCore::EditingStyle::hasStyle):
665
666         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
667         because WebPage::editorState will now query for multiple styles at the selection start, but
668         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
669         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
670         computed EditingStyle at selection start.
671
672         * editing/EditingStyle.h:
673         * editing/Editor.cpp:
674         (WebCore::Editor::selectionStartHasStyle const):
675
676 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
677
678         [TexMap] Add TextureMapperContextAttributes
679         https://bugs.webkit.org/show_bug.cgi?id=175311
680
681         Reviewed by Carlos Garcia Campos.
682
683         Add and use TextureMapperContextAttributes, a slim struct that holds
684         information about the type and extensions supported by the OpenGL
685         context that's being used for one specific TextureMapperGL instance.
686
687         This struct is initialized in the TextureMapperGL constructor for the
688         OpenGL context that's been made current on that thread, and that will
689         be used for that TextureMapperGL instance through its lifetime. The
690         struct is then also copied into any BitmapTextureGL objects that have
691         been created through this TextureMapperGL (or its texture pool).
692
693         The struct is initialized with information about GLES2 support (which
694         is at this point done through the USE_OPENGL_ES_2 macro) and about
695         specific OpenGL extensions that are supported. These are then used in
696         TextureMapperGL (NPOT textures) and BitmapTextureGL (BGRA support,
697         sub-image unpacking) to deploy specific optimizations or workarounds.
698
699         This ultimately serves as a replacement for clunky static functions
700         that need to operate on GraphicsContext3D objects to retrieve this
701         information.
702
703         No new tests -- no change in behavior.
704
705         * platform/TextureMapper.cmake:
706         * platform/graphics/texmap/BitmapTextureGL.cpp:
707         (WebCore::BitmapTextureGL::BitmapTextureGL):
708         (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
709         (WebCore::BitmapTextureGL::updateContents):
710         (WebCore::driverSupportsSubImage): Deleted.
711         * platform/graphics/texmap/BitmapTextureGL.h:
712         (WebCore::BitmapTextureGL::create):
713         * platform/graphics/texmap/BitmapTexturePool.cpp:
714         (WebCore::BitmapTexturePool::BitmapTexturePool):
715         (WebCore::BitmapTexturePool::createTexture):
716         * platform/graphics/texmap/BitmapTexturePool.h:
717         * platform/graphics/texmap/TextureMapperContextAttributes.cpp: Added.
718         (WebCore::TextureMapperContextAttributes::initialize):
719         * platform/graphics/texmap/TextureMapperContextAttributes.h: Added.
720         * platform/graphics/texmap/TextureMapperGL.cpp:
721         (WebCore::TextureMapperGL::TextureMapperGL):
722         (WebCore::TextureMapperGL::drawTexture):
723         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
724         (WebCore::TextureMapperGL::createTexture):
725         (WebCore::driverSupportsNPOTTextures): Deleted.
726         * platform/graphics/texmap/TextureMapperGL.h:
727
728 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
729
730         [TexMap] Don't expose GraphicsContext3D object
731         https://bugs.webkit.org/show_bug.cgi?id=175310
732
733         Reviewed by Carlos Garcia Campos.
734
735         Remove the GraphicsContext3D getter from the TextureMapperGL class. Instead,
736         the clearColor() method is added that's to be used by the CoordinatedGraphicsScene
737         class which was accessing the GraphicsContext3D object for this purpose.
738
739         * platform/graphics/texmap/TextureMapper.h:
740         * platform/graphics/texmap/TextureMapperGL.cpp:
741         (WebCore::TextureMapperGL::clearColor):
742         * platform/graphics/texmap/TextureMapperGL.h:
743         (WebCore::TextureMapperGL::graphicsContext3D const): Deleted.
744
745 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
746
747         RenderStyle:diff() was inadvertently doing deep compares of StyleRareNonInheritedData etc
748         https://bugs.webkit.org/show_bug.cgi?id=175304
749
750         Reviewed by Tim Horton.
751
752         r210758 changed DataRef::get() from returning a pointer to a reference. This caused all the places
753         in RenderStyle::diff() and related functions, where we intended to do a quick pointer comparison,
754         to doing deep compares via operator!=. This made the code slightly slower.
755
756         Fix by exposing ptr() on DataRef and using it wherever we wish to do pointer comparison.
757
758         * rendering/style/DataRef.h:
759         (WebCore::DataRef::ptr const):
760         * rendering/style/RenderStyle.cpp:
761         (WebCore::RenderStyle::inheritedDataShared const):
762         (WebCore::RenderStyle::changeAffectsVisualOverflow const):
763         (WebCore::RenderStyle::changeRequiresLayout const):
764         (WebCore::RenderStyle::changeRequiresRecompositeLayer const):
765         (WebCore::RenderStyle::listStyleImage const): Expand the function onto multiple lines.
766
767 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
768
769         Add a fast path for rotate() and rotateZ() transform parsing
770         https://bugs.webkit.org/show_bug.cgi?id=175308
771
772         Reviewed by Zalan Bujtas.
773
774         Fast paths only existed for translate-related functions, matrix3d() and scale3d(). Add
775         rotate() and rotateX(), which gives a small boost to one of the MotionMark tests.
776
777         * css/parser/CSSParserFastPaths.cpp:
778         (WebCore::parseSimpleAngle):
779         (WebCore::parseTransformAngleArgument):
780         (WebCore::parseSimpleTransformValue):
781         (WebCore::transformCanLikelyUseFastPath):
782
783 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
784
785         Re-order the tests in RenderLayerCompositor::requiresCompositingLayer() for performance
786         https://bugs.webkit.org/show_bug.cgi?id=175306
787
788         Reviewed by Tim Horton.
789
790         Re-order the tests for compositing reasons so that reasons more likely to happen are higher in the list.
791
792         * rendering/RenderLayerCompositor.cpp:
793         (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
794         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
795
796 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
797
798         Avoid a hash lookup in FilterInfo::remove()
799         https://bugs.webkit.org/show_bug.cgi?id=175301
800
801         Reviewed by Sam Weinig.
802
803         FilterInfo::remove() always called map().remove(&layer)), even when layer.m_hasFilterInfo
804         was false (and even asserted that layer.m_hasFilterInfo == map().contains(&layer)).
805
806         So we can early return if layer.m_hasFilterInfo is false.
807
808         * rendering/RenderLayerFilterInfo.cpp:
809         (WebCore::RenderLayer::FilterInfo::getIfExists):
810         (WebCore::RenderLayer::FilterInfo::remove):
811
812 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
813
814         Make TransformOperation::type() non-virtual
815         https://bugs.webkit.org/show_bug.cgi?id=175297
816
817         Reviewed by Sam Weinig.
818
819         Store the OperationType in the base class so that type() and isSameType() can
820         be non-virtual.
821
822         Small perf win on some benchmarks.
823
824         * platform/graphics/transforms/IdentityTransformOperation.h:
825         * platform/graphics/transforms/Matrix3DTransformOperation.h:
826         * platform/graphics/transforms/MatrixTransformOperation.h:
827         * platform/graphics/transforms/PerspectiveTransformOperation.h:
828         * platform/graphics/transforms/RotateTransformOperation.cpp:
829         (WebCore::RotateTransformOperation::blend):
830         * platform/graphics/transforms/RotateTransformOperation.h:
831         * platform/graphics/transforms/ScaleTransformOperation.cpp:
832         (WebCore::ScaleTransformOperation::blend):
833         * platform/graphics/transforms/ScaleTransformOperation.h:
834         * platform/graphics/transforms/SkewTransformOperation.cpp:
835         (WebCore::SkewTransformOperation::blend):
836         * platform/graphics/transforms/SkewTransformOperation.h:
837         * platform/graphics/transforms/TransformOperation.h:
838         (WebCore::TransformOperation::TransformOperation):
839         (WebCore::TransformOperation::type const):
840         (WebCore::TransformOperation::isSameType const):
841         * platform/graphics/transforms/TranslateTransformOperation.cpp:
842         (WebCore::TranslateTransformOperation::blend):
843         * platform/graphics/transforms/TranslateTransformOperation.h:
844
845 2017-08-07  Simon Fraser  <simon.fraser@apple.com>
846
847         Inline ~Color and Color::isExtended()
848         https://bugs.webkit.org/show_bug.cgi?id=175293
849
850         Reviewed by Zalan Bujtas.
851
852         The Color destructor and Color::isExtended() show up on profiles, so inline them.
853         Before r207265 the destructor was inlined.
854         
855         Also make sure that LengthSize::operator== is inlined, which it was not (according
856         to profiles).
857
858         * platform/LengthSize.h:
859         (WebCore::operator==):
860         * platform/graphics/Color.cpp:
861         (WebCore::Color::~Color): Deleted.
862         (WebCore::Color::isExtended const): Deleted.
863         * platform/graphics/Color.h:
864         (WebCore::Color::~Color):
865         (WebCore::Color::isExtended const):
866
867 2017-08-04  Brent Fulgham  <bfulgham@apple.com>
868
869         Implement the HTML5 same-origin restriction specification
870         https://bugs.webkit.org/show_bug.cgi?id=175226
871         <rdar://problem/11079948>
872
873         Reviewed by Chris Dumez.
874
875         Follow the algorithms defined in the HTML5 specification for relaxing
876         the same-origin restriction. We were missing a few steps related to
877         checking for public suffix and presence of a browsing context.
878
879         Tested by new TestWebKitAPI tests.
880
881         * dom/Document.cpp:
882         (WebCore::Document::domainIsRegisterable): Added helper function.
883         (WebCore::Document::setDomain):
884
885 2017-08-07  Devin Rousso  <drousso@apple.com>
886
887         Web Inspector: Preview Canvas path when viewing a recording
888         https://bugs.webkit.org/show_bug.cgi?id=174967
889
890         Reviewed by Brian Burg.
891
892         Tests: fast/canvas/2d.currentPoint.html
893                fast/canvas/2d.getPath.modification.html
894                fast/canvas/2d.getPath.newobject.html
895                fast/canvas/2d.setPath.html
896
897         * html/canvas/CanvasPath.idl:
898         * html/canvas/CanvasPath.h:
899         * html/canvas/CanvasPath.cpp:
900         (WebCore::CanvasPath::currentX const):
901         (WebCore::CanvasPath::currentY const):
902
903         * html/canvas/CanvasRenderingContext2D.idl:
904         * html/canvas/CanvasRenderingContext2D.h:
905         * html/canvas/CanvasRenderingContext2D.cpp:
906         (WebCore::CanvasRenderingContext2D::setPath):
907         (WebCore::CanvasRenderingContext2D::getPath const):
908
909         * page/RuntimeEnabledFeatures.h:
910         (WebCore::RuntimeEnabledFeatures::setInspectorAdditionsEnabled):
911         (WebCore::RuntimeEnabledFeatures::inspectorAdditionsEnabled const):
912         Add runtime flag for added IDL items above so that they are only usable within the inspector
913         process. The runtime flag is not enabled from anywhere else as of now.
914
915         * inspector/InspectorCanvas.cpp:
916         (WebCore::InspectorCanvas::buildInitialState):
917         Send current path as part of the InitialState.
918         Drive-by: deduplicate more string values.
919
920 2017-08-07  Chris Dumez  <cdumez@apple.com>
921
922         Update sendBeacon() to rely on FetchBody instead of the whole FetchRequest
923         https://bugs.webkit.org/show_bug.cgi?id=175280
924
925         Reviewed by Youenn Fablet.
926
927         Update sendBeacon() to rely on FetchBody instead of the whole FetchRequest. FetchBody
928         for data extraction is really the only thing we need at the moment.
929         The new code also properly sets the CORS mode, which will be needed for Bug 175264.
930
931         * Modules/beacon/NavigatorBeacon.cpp:
932         (WebCore::NavigatorBeacon::sendBeacon):
933
934 2017-08-07  Michael Catanzaro  <mcatanzaro@igalia.com>
935
936         -Wimplicit-fallthrough warning in ComputedStyleExtractor::propertyValue
937         https://bugs.webkit.org/show_bug.cgi?id=174469
938         <rdar://problem/33311638>
939
940         Reviewed by Simon Fraser.
941
942         Add a RELEASE_ASSERT_NOT_REACHED to silence this warning.
943
944         * css/CSSComputedStyleDeclaration.cpp:
945         (WebCore::ComputedStyleExtractor::propertyValue):
946
947 2017-08-06  Filip Pizlo  <fpizlo@apple.com>
948
949         Primitive auxiliaries and JSValue auxiliaries should have separate gigacages
950         https://bugs.webkit.org/show_bug.cgi?id=174919
951
952         Reviewed by Keith Miller.
953
954         No new tests because no change in behavior.
955         
956         Adapting to API changes - we now specify the AlignedMemoryAllocator differently and we need to be
957         specific about which Gigacage we're using.
958
959         * bindings/js/WebCoreJSClientData.cpp:
960         (WebCore::JSVMClientData::JSVMClientData):
961         * platform/graphics/cocoa/GPUBufferMetal.mm:
962         (WebCore::GPUBuffer::GPUBuffer):
963
964 2017-08-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
965
966         [Curl] Add abstraction layer of cookie jar implementation for Curl port
967         https://bugs.webkit.org/show_bug.cgi?id=174943
968
969         Reviewed by Brent Fulgham.
970
971         * platform/network/curl/CookieJarCurl.cpp:
972         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
973         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
974         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
975         (WebCore::CookieJarCurlFileSystem::cookiesEnabled):
976         (WebCore::CookieJarCurlFileSystem::getRawCookies):
977         (WebCore::CookieJarCurlFileSystem::deleteCookie):
978         (WebCore::CookieJarCurlFileSystem::getHostnamesWithCookies):
979         (WebCore::CookieJarCurlFileSystem::deleteCookiesForHostnames):
980         (WebCore::CookieJarCurlFileSystem::deleteAllCookies):
981         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
982         (WebCore::cookiesForDOM):
983         (WebCore::setCookiesFromDOM):
984         (WebCore::cookieRequestHeaderFieldValue):
985         (WebCore::cookiesEnabled):
986         (WebCore::getRawCookies):
987         (WebCore::deleteCookie):
988         (WebCore::getHostnamesWithCookies):
989         (WebCore::deleteCookiesForHostnames):
990         (WebCore::deleteAllCookies):
991         (WebCore::deleteAllCookiesModifiedSince):
992         * platform/network/curl/CookieJarCurl.h: Added.
993         * platform/network/curl/CurlContext.cpp:
994         * platform/network/curl/CurlContext.h:
995         (WebCore::CurlContext::cookieJar):
996
997 2017-08-07  Brady Eidson  <beidson@apple.com>
998
999         Implement most of ServiceWorkerContainer::addRegistration.
1000         https://bugs.webkit.org/show_bug.cgi?id=175237
1001
1002         Reviewed by Andy Estes.
1003
1004         No new tests (Covered by changes to existing tests).
1005
1006         There's still so much supporting infrastructure to add with these early patches
1007         that I'm still moving them in baby steps for now, hence not implementing
1008         register() all in one shot.
1009         
1010         Things will start moving very quickly once we no longer need to add lots of new
1011         primitives in each change.
1012         
1013         * CMakeLists.txt:
1014         * DerivedSources.make:
1015         * WebCore.xcodeproj/project.pbxproj:
1016         
1017         * page/DOMWindow.cpp:
1018         (WebCore::DOMWindow::navigator const):
1019         
1020         * page/Navigator.cpp:
1021         (WebCore::Navigator::Navigator): Make the constructor take a ScriptExecutionContext for 
1022           creation of objects where its import (e.g. ServiceWorkerContainer).
1023         * page/Navigator.h:
1024
1025         * page/WorkerNavigator.cpp:
1026         (WebCore::WorkerNavigator::WorkerNavigator): Ditto.
1027         * page/WorkerNavigator.h:
1028
1029         * page/NavigatorBase.cpp:
1030         (WebCore::NavigatorBase::NavigatorBase): Create the ServiceWorkerContainer upfront with
1031           the passed-in ScriptExecutionContext.
1032         (WebCore::NavigatorBase::serviceWorker):
1033         * page/NavigatorBase.h:
1034         
1035         Make ServiceWorkerContainer into an ActiveDOMObject. This will eventually be necessary for
1036         Document suspension reasons, but is also necessary because it also needs to be a
1037         ContextDestructionObserver (which ActiveDOMObject is):
1038         * workers/ServiceWorkerContainer.cpp:
1039         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1040         (WebCore::ServiceWorkerContainer::ready):
1041         (WebCore::ServiceWorkerContainer::addRegistration):
1042         (WebCore::ServiceWorkerContainer::getRegistration):
1043         (WebCore::ServiceWorkerContainer::getRegistrations):
1044         (WebCore::ServiceWorkerContainer::activeDOMObjectName const):
1045         (WebCore::ServiceWorkerContainer::canSuspendForDocumentSuspension const):
1046         (WebCore::rejectLater): Deleted.
1047         (WebCore::ServiceWorkerContainer::eventTargetInterface const): Deleted.
1048         (WebCore::ServiceWorkerContainer::scriptExecutionContext const): Deleted.
1049         * workers/ServiceWorkerContainer.h:
1050         * workers/ServiceWorkerContainer.idl:
1051
1052         Add updateViaCache, etc:
1053         * workers/ServiceWorkerRegistration.cpp:
1054         (WebCore::ServiceWorkerRegistration::updateViaCache const):
1055         (WebCore::ServiceWorkerRegistration::update):
1056         (WebCore::ServiceWorkerRegistration::unregister):
1057         * workers/ServiceWorkerRegistration.h:
1058         * workers/ServiceWorkerRegistration.idl:
1059
1060         * workers/ServiceWorkerUpdateViaCache.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1061         * workers/ServiceWorkerUpdateViaCache.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1062
1063         * workers/WorkerGlobalScope.cpp:
1064         (WebCore::WorkerGlobalScope::navigator):
1065         (WebCore::WorkerGlobalScope::navigator const): Deleted.
1066         * workers/WorkerGlobalScope.h:
1067
1068         * workers/WorkerType.h: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1069         * workers/WorkerType.idl: Copied from Source/WebCore/workers/ServiceWorkerRegistration.idl.
1070
1071 2017-08-07  Ryan Haddad  <ryanhaddad@apple.com>
1072
1073         Unreviewed, rolling out r220299.
1074
1075         This change caused LayoutTest inspector/dom-debugger/dom-
1076         breakpoints.html to fail.
1077
1078         Reverted changeset:
1079
1080         "Web Inspector: capture async stack trace when workers/main
1081         context posts a message"
1082         https://bugs.webkit.org/show_bug.cgi?id=167084
1083         http://trac.webkit.org/changeset/220299
1084
1085 2017-08-07  Brian Burg  <bburg@apple.com>
1086
1087         Cleanup: simplify WebSockets code for RuntimeEnabledFeatures
1088         https://bugs.webkit.org/show_bug.cgi?id=175190
1089
1090         Reviewed by Sam Weinig.
1091
1092         This runtime enabled flag is not used by anything. It was added
1093         for V8 in <https://bugs.webkit.org/show_bug.cgi?id=29896>.
1094
1095         * Modules/websockets/WebSocket.cpp:
1096         (WebCore::WebSocket::setIsAvailable): Deleted.
1097         (WebCore::WebSocket::isAvailable): Deleted.
1098         * Modules/websockets/WebSocket.h:
1099         * Modules/websockets/WebSocket.idl:
1100         * page/RuntimeEnabledFeatures.cpp:
1101         (WebCore::RuntimeEnabledFeatures::webSocketEnabled const): Deleted.
1102         * page/RuntimeEnabledFeatures.h:
1103
1104 2017-08-07  Brian Burg  <bburg@apple.com>
1105
1106         Remove CANVAS_PATH compilation guard
1107         https://bugs.webkit.org/show_bug.cgi?id=175207
1108
1109         Reviewed by Sam Weinig.
1110
1111         * Configurations/FeatureDefines.xcconfig:
1112         * html/canvas/DOMPath.h:
1113         * html/canvas/DOMPath.idl:
1114
1115 2017-08-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1116
1117         [WPE][CMake] Only pass pkg-config CFLAGS from (E)GL when not using libepoxy.
1118         https://bugs.webkit.org/show_bug.cgi?id=175125
1119
1120         Reviewed by Michael Catanzaro.
1121
1122         No change of behavior, covered by existing tests.
1123
1124         * CMakeLists.txt: Instead of negating 3 times the use of libepoxy
1125         move the logic for (E)GL detection inside an else() block.
1126
1127 2017-08-07  Antti Koivisto  <antti@apple.com>
1128
1129         REGRESSION (r219121): Airmail 3 prints header part only.
1130         https://bugs.webkit.org/show_bug.cgi?id=175258
1131         <rdar://problem/33601173>
1132
1133         Reviewed by Andreas Kling.
1134
1135         When a WK1 WebViw is printed via AppKit view hierarchy it won't explictly set the page width
1136         but uses the existing width. r219121 assumes that all printing code paths set the page width.
1137
1138         No test, there appears to be no good way to test AppKit printing behaviors without adding complicated
1139         new testing infrastructure.
1140
1141         * rendering/RenderView.cpp:
1142         (WebCore::RenderView::layout):
1143
1144             If we are in printing layout and don't have page width set yet then use the current view width.
1145             This matches the behavior prior r219121.
1146
1147 2017-08-05  Youenn Fablet  <youenn@apple.com>
1148
1149         [Fetch API] Response should keep all ResourceResponse information
1150         https://bugs.webkit.org/show_bug.cgi?id=175099
1151
1152         Reviewed by Sam Weinig.
1153
1154         No change of behavior, covered by existing tests.
1155
1156         Disabling filtering of resource response at DocumentThreadableLoader for fetch API and doing the filtering at FetchResponse level.
1157         This requires passing the tainting parameter to FetchResponse. For that purpose, we store the tainting on the ResourceResponse itself.
1158         This allows mimicking the concept of internal response from the fetch spec.
1159         This might be useful for future developments related to caching the responses.
1160
1161         The body is now also stored in FetchResponse so a flag is added to ensure we only expose the body if allowed.
1162
1163         Changing storage of opaque redirect information to keep the redirection information in the response.
1164
1165         * Modules/fetch/FetchBodyOwner.cpp:
1166         (WebCore::FetchBodyOwner::blob):
1167         (WebCore::FetchBodyOwner::consumeNullBody):
1168         * Modules/fetch/FetchBodyOwner.h:
1169         * Modules/fetch/FetchLoader.cpp:
1170         (WebCore::FetchLoader::start):
1171         * Modules/fetch/FetchResponse.cpp:
1172         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
1173         (WebCore::FetchResponse::consume):
1174         (WebCore::FetchResponse::consumeBodyAsStream):
1175         (WebCore::FetchResponse::createReadableStreamSource):
1176         * Modules/fetch/FetchResponse.h:
1177         * loader/DocumentThreadableLoader.cpp:
1178         (WebCore::DocumentThreadableLoader::responseReceived):
1179         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1180         (WebCore::DocumentThreadableLoader::didFinishLoading):
1181         (WebCore::DocumentThreadableLoader::loadRequest):
1182         * loader/DocumentThreadableLoader.h:
1183         * loader/SubresourceLoader.cpp:
1184         (WebCore::SubresourceLoader::willSendRequestInternal):
1185         * loader/cache/CachedResource.cpp:
1186         (WebCore::CachedResource::setBodyDataFrom):
1187         (WebCore::CachedResource::setResponse):
1188         * platform/network/ResourceResponseBase.cpp:
1189         (WebCore::ResourceResponseBase::crossThreadData const):
1190         (WebCore::ResourceResponseBase::fromCrossThreadData):
1191         (WebCore::ResourceResponseBase::filter):
1192         * platform/network/ResourceResponseBase.h:
1193         (WebCore::ResourceResponseBase::setTainting):
1194         (WebCore::ResourceResponseBase::tainting const):
1195         (WebCore::ResourceResponseBase::encode const):
1196         (WebCore::ResourceResponseBase::decode):
1197
1198 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1199
1200         WebDriver: use in-view center point for clicks instead of bounding box center point
1201         https://bugs.webkit.org/show_bug.cgi?id=174863
1202
1203         Reviewed by Simon Fraser.
1204
1205         Make DOMRect, and FloatPoint::narrowPrecision() available to WebKit layer. Also add
1206         FrameView::clientToDocumentPoint().
1207
1208         * WebCore.xcodeproj/project.pbxproj:
1209         * dom/Element.h:
1210         * page/FrameView.h:
1211         * platform/graphics/FloatPoint.h:
1212
1213 2017-08-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1214
1215         getClientRects doesn't work with list box option elements
1216         https://bugs.webkit.org/show_bug.cgi?id=175016
1217
1218         Reviewed by Darin Adler.
1219
1220         Since HTMLOptionElement and HTMLOptGroupElement don't have a renderer, we are always returning an empty list
1221         from getClientRects. This is working fine in both chromium and firefox, option elements return its own bounding
1222         box and group elements return the bounding box of the group label and all its children items.
1223
1224         Test: fast/dom/HTMLSelectElement/listbox-items-client-rects.html
1225
1226         * dom/Element.cpp:
1227         (WebCore::listBoxElementBoundingBox): Helper function to return the bounding box of a HTMLOptionElement or
1228         HTMLOptGroupElement element.
1229         (WebCore::Element::getClientRects): Use listBoxElementBoundingBox() in case of HTMLOptionElement or
1230         HTMLOptGroupElement.
1231         (WebCore::Element::boundingClientRect): Ditto.
1232
1233 2017-08-04  Youenn Fablet  <youenn@apple.com>
1234
1235         [Cache API] Add Cache and CacheStorage IDL definitions
1236         https://bugs.webkit.org/show_bug.cgi?id=175201
1237
1238         Reviewed by Brady Eidson.
1239
1240         Covered by activated tests.
1241         Adding IDLs as per https://www.w3.org/TR/service-workers-1/#idl-index.
1242         Implementation is guarded by a runtime flag which is off by default.
1243         It is off for DRT but on for WTR.
1244
1245         * CMakeLists.txt:
1246         * DerivedSources.make:
1247         * Modules/cache/Cache.cpp: Added.
1248         (WebCore::Cache::match):
1249         (WebCore::Cache::matchAll):
1250         (WebCore::Cache::add):
1251         (WebCore::Cache::addAll):
1252         (WebCore::Cache::put):
1253         (WebCore::Cache::remove):
1254         (WebCore::Cache::keys):
1255         * Modules/cache/Cache.h: Added.
1256         (WebCore::Cache::create):
1257         (WebCore::Cache::Cache):
1258         * Modules/cache/Cache.idl: Added.
1259         * Modules/cache/CacheQueryOptions.h: Added.
1260         * Modules/cache/CacheQueryOptions.idl: Added.
1261         * Modules/cache/CacheStorage.cpp: Added.
1262         (WebCore::CacheStorage::match):
1263         (WebCore::CacheStorage::has):
1264         (WebCore::CacheStorage::open):
1265         (WebCore::CacheStorage::remove):
1266         (WebCore::CacheStorage::keys):
1267         * Modules/cache/CacheStorage.h: Added.
1268         (WebCore::CacheStorage::create):
1269         * Modules/cache/CacheStorage.idl: Added.
1270         * Modules/cache/DOMWindowCaches.cpp: Added.
1271         (WebCore::DOMWindowCaches::DOMWindowCaches):
1272         (WebCore::DOMWindowCaches::supplementName):
1273         (WebCore::DOMWindowCaches::from):
1274         (WebCore::DOMWindowCaches::caches):
1275         (WebCore::DOMWindowCaches::caches const):
1276         * Modules/cache/DOMWindowCaches.h: Added.
1277         * Modules/cache/DOMWindowCaches.idl: Added.
1278         * Modules/cache/WorkerGlobalScopeCaches.cpp: Added.
1279         (WebCore::WorkerGlobalScopeCaches::supplementName):
1280         (WebCore::WorkerGlobalScopeCaches::from):
1281         (WebCore::WorkerGlobalScopeCaches::caches):
1282         (WebCore::WorkerGlobalScopeCaches::caches const):
1283         * Modules/cache/WorkerGlobalScopeCaches.h: Added.
1284         * Modules/cache/WorkerGlobalScopeCaches.idl: Added.
1285         * WebCore.xcodeproj/project.pbxproj:
1286         * page/RuntimeEnabledFeatures.h:
1287         (WebCore::RuntimeEnabledFeatures::setCacheAPIEnabled):
1288         (WebCore::RuntimeEnabledFeatures::cacheAPIEnabled const):
1289
1290 2017-08-04  Brady Eidson  <beidson@apple.com>
1291
1292         Have navigator.serviceWorker() actually return a ServiceWorkerContainer object.
1293         https://bugs.webkit.org/show_bug.cgi?id=175215
1294
1295         Reviewed by Youenn Fablet.
1296
1297         * page/NavigatorBase.cpp:
1298         (WebCore::NavigatorBase::serviceWorker): Actually create and remember an object.
1299         * page/NavigatorBase.h:
1300
1301         * workers/ServiceWorkerContainer.cpp:
1302         (WebCore::rejectLater): Asynchronously reject the given promise with an error message.
1303         (WebCore::ServiceWorkerContainer::ServiceWorkerContainer):
1304         (WebCore::ServiceWorkerContainer::refEventTarget): Ref the underlying Navigator.
1305         (WebCore::ServiceWorkerContainer::derefEventTarget): Deref the underlying Navigator.
1306         (WebCore::ServiceWorkerContainer::ready): rejectLater the promise.
1307         (WebCore::ServiceWorkerContainer::addRegistration): Ditto.
1308         (WebCore::ServiceWorkerContainer::getRegistration): Ditto.
1309         (WebCore::ServiceWorkerContainer::getRegistrations): Ditto.
1310         * workers/ServiceWorkerContainer.h:
1311
1312 2017-08-04  Chris Dumez  <cdumez@apple.com>
1313
1314         [Beacon] Update sendBeacon to use the CachedResourceLoader
1315         https://bugs.webkit.org/show_bug.cgi?id=175192
1316         <rdar://problem/33725923>
1317
1318         Reviewed by Youenn Fablet.
1319
1320         Update sendBeacon to use the FetchRequest / CachedResourceLoader instead of
1321         the PingLoader. This gets us closer to the specification which is based on
1322         Fetch and reduces code duplication. This also fixes an issue where our
1323         Origin header was not properly set on Beacon resquests.
1324
1325         In a follow-up, we will implement in CachedResourceLoader Fetch's quota for
1326         inflight keepalive requests which is needed to fully support sendBeacon().
1327
1328         * Modules/beacon/NavigatorBeacon.cpp:
1329         (WebCore::NavigatorBeacon::sendBeacon):
1330         * Modules/beacon/NavigatorBeacon.h:
1331         * loader/LinkLoader.cpp:
1332         (WebCore::createLinkPreloadResourceClient):
1333         * loader/PingLoader.cpp:
1334         * loader/PingLoader.h:
1335         * loader/ResourceLoadInfo.cpp:
1336         (WebCore::toResourceType):
1337         * loader/SubresourceLoader.cpp:
1338         (WebCore::logResourceLoaded):
1339         * loader/cache/CachedResource.cpp:
1340         (WebCore::CachedResource::defaultPriorityForResourceType):
1341         (WebCore::CachedResource::load):
1342         * loader/cache/CachedResource.h:
1343         * loader/cache/CachedResourceLoader.cpp:
1344         (WebCore::createResource):
1345         (WebCore::CachedResourceLoader::requestBeaconResource):
1346         (WebCore::contentTypeFromResourceType):
1347         (WebCore::CachedResourceLoader::checkInsecureContent const):
1348         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
1349         (WebCore::isResourceSuitableForDirectReuse):
1350         * loader/cache/CachedResourceLoader.h:
1351
1352 2017-08-04  John Wilander  <wilander@apple.com>
1353
1354         Resource Load Statistics: Report user interaction immediately, but only when needed
1355         https://bugs.webkit.org/show_bug.cgi?id=175090
1356         <rdar://problem/33685546>
1357
1358         Reviewed by Chris Dumez.
1359
1360         Test: http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
1361
1362         * loader/ResourceLoadObserver.cpp:
1363         (WebCore::ResourceLoadObserver::ResourceLoadObserver):
1364         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1365             Now tells the UI process immediately but also records that it has
1366             done so to avoid doing it when not needed.
1367         (WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
1368             Conditional throttling gone, now always throttles.
1369         (WebCore::ResourceLoadObserver::notifyObserver):
1370             Renamed from ResourceLoadObserver::notificationTimerFired().
1371         (WebCore::ResourceLoadObserver::clearState):
1372             New function to allow the test runner to reset the web process'
1373             statistics state now that we keep track of whether or not we've
1374             reported user interaction to the UI process.
1375         (WebCore::ResourceLoadObserver::setShouldThrottleObserverNotifications): Deleted.
1376         (WebCore::ResourceLoadObserver::notificationTimerFired): Deleted.
1377         * loader/ResourceLoadObserver.h:
1378         (): Deleted.
1379         * testing/Internals.cpp:
1380         (WebCore::Internals::resetToConsistentState):
1381         (WebCore::Internals::setResourceLoadStatisticsShouldThrottleObserverNotifications): Deleted.
1382             No longer needed since user interaction is always communicated
1383             immediately.
1384         * testing/Internals.h:
1385         * testing/Internals.idl:
1386
1387 2017-08-04  Matt Baker  <mattbaker@apple.com>
1388
1389         Web Inspector: capture async stack trace when workers/main context posts a message
1390         https://bugs.webkit.org/show_bug.cgi?id=167084
1391         <rdar://problem/30033673>
1392
1393         Reviewed by Brian Burg.
1394
1395         Add instrumentation to DOMWindow to support showing asynchronous
1396         stack traces when the debugger pauses in a MessageEvent handler.
1397
1398         Test: inspector/debugger/async-stack-trace.html
1399
1400         * inspector/InspectorInstrumentation.cpp:
1401         (WebCore::InspectorInstrumentation::didPostMessageImpl):
1402         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
1403         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
1404         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
1405
1406         * inspector/InspectorInstrumentation.h:
1407         (WebCore::InspectorInstrumentation::didPostMessage):
1408         (WebCore::InspectorInstrumentation::didFailPostMessage):
1409         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
1410         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
1411
1412         * inspector/PageDebuggerAgent.cpp:
1413         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
1414         (WebCore::PageDebuggerAgent::didPostMessage):
1415         (WebCore::PageDebuggerAgent::didFailPostMessage):
1416         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
1417         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
1418         * inspector/PageDebuggerAgent.h:
1419
1420         * page/DOMWindow.cpp:
1421         (WebCore::DOMWindow::postMessage):
1422         (WebCore::DOMWindow::postMessageTimerFired):
1423
1424 2017-08-04  Devin Rousso  <drousso@apple.com>
1425
1426         Web Inspector: add source view for WebGL shader programs
1427         https://bugs.webkit.org/show_bug.cgi?id=138593
1428         <rdar://problem/18936194>
1429
1430         Reviewed by Matt Baker.
1431
1432         Test: inspector/canvas/requestShaderSource.html
1433
1434         * inspector/InspectorCanvasAgent.h:
1435         * inspector/InspectorCanvasAgent.cpp:
1436         (WebCore::InspectorCanvasAgent::requestShaderSource):
1437
1438         * inspector/InspectorShaderProgram.h:
1439         * inspector/InspectorShaderProgram.cpp:
1440         (WebCore::InspectorShaderProgram::shaderForType):
1441
1442 2017-08-04  Matt Lewis  <jlewis3@apple.com>
1443
1444         Unreviewed, rolling out r220288.
1445
1446         This broke multiple builds.
1447
1448         Reverted changeset:
1449
1450         "Use MPAVRoutingController instead of deprecated versions."
1451         https://bugs.webkit.org/show_bug.cgi?id=175063
1452         http://trac.webkit.org/changeset/220288
1453
1454 2017-08-03  Filip Pizlo  <fpizlo@apple.com>
1455
1456         The allocator used to allocate memory for MarkedBlocks and LargeAllocations should not be the Subspace itself
1457         https://bugs.webkit.org/show_bug.cgi?id=175141
1458
1459         Reviewed by Mark Lam.
1460
1461         No new tests because no new behavior.
1462         
1463         Just adapting to an API change.
1464
1465         * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Added.
1466         * bindings/js/WebCoreJSClientData.cpp:
1467         (WebCore::JSVMClientData::JSVMClientData):
1468
1469 2017-08-04  Chris Dumez  <cdumez@apple.com>
1470
1471         Match newly-clarified spec on textarea defaultValue/value/child text content
1472         https://bugs.webkit.org/show_bug.cgi?id=173878
1473
1474         Reviewed by Darin Adler.
1475
1476         Update HTMLTextArea.defaultValue to match align with other browsers and match the
1477         latest HTML specification:
1478         - https://html.spec.whatwg.org/#dom-textarea-defaultvalue
1479
1480         The defaultValue getter should return the child text content:
1481         - https://dom.spec.whatwg.org/#concept-child-text-content
1482         Our code was traversing all Text descendants, not just the children.
1483
1484         The defaultValue setter should act as the setter of the Element's textContent
1485         IDL attribute. Previously, we had a custom logic that was only removing the
1486         text children.
1487
1488         Test: imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html
1489
1490         * dom/ScriptElement.cpp:
1491         (WebCore::ScriptElement::scriptContent const):
1492         * dom/TextNodeTraversal.cpp:
1493         (WebCore::TextNodeTraversal::childTextContent):
1494         * dom/TextNodeTraversal.h:
1495         * html/HTMLTextAreaElement.cpp:
1496         (WebCore::HTMLTextAreaElement::defaultValue const):
1497         (WebCore::HTMLTextAreaElement::setDefaultValue):
1498         * html/HTMLTitleElement.cpp:
1499         (WebCore::HTMLTitleElement::text const):
1500
1501 2017-08-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
1502
1503         RenderImageResourceStyleImage::image() should return the nullImage() if the image is not available
1504         https://bugs.webkit.org/show_bug.cgi?id=174874
1505         <rdar://problem/33530130>
1506
1507         Reviewed by Simon Fraser.
1508
1509         If an <img> element has a non-CachedImage content data, e.g. -webkit-named-image,
1510         RenderImageResourceStyleImage will be created and  attached to the RenderImage.
1511         RenderImageResourceStyleImage::m_cachedImage will be set to null at the 
1512         beginning because the m_styleImage->isCachedImage() is false in this case.
1513         When ImageLoader finishes loading the url of the src attribute,
1514         RenderImageResource::setCachedImage() will be called to set m_cachedImage.
1515
1516         A crash will happen when the RenderImage is destroyed. Destroying the 
1517         RenderImage calls RenderImageResourceStyleImage::shutdown() which checks
1518         m_cachedImage and finds it not null, so it calls RenderImageResourceStyleImage::image()
1519         which ends up calling CSSNamedImageValue::image() which returns a null pointer
1520         because the size is empty. RenderImageResourceStyleImage::shutdown() calls
1521         image()->stopAnimation() without checking the return value of image().
1522
1523         Another crash will happen later when deleting the CachedImage from the memory
1524         cache if CachedImage::canDestroyDecodedData() is called because the client
1525         it gets from m_clients is a freed pointer. This happens because RenderImageResourceStyleImage
1526         has m_styleImage of type StyleGeneratedImage but its m_cachedImage is set
1527         by RenderImageResource::setCachedImage(). When RenderImageResourceStyleImage::shutdown()
1528         is called, it calls  StyleGeneratedImage::removeClient() which does not 
1529         know anything about RenderImageResourceStyleImage::m_cachedImage. So we 
1530         end up having a freed pointer in the m_clients of the CachedImage.
1531
1532         Test: fast/images/image-element-image-content-data.html
1533
1534         * rendering/RenderImageResourceStyleImage.cpp:
1535         (WebCore::RenderImageResourceStyleImage::shutdown):  Revert back the changes
1536         of r208511 in this function. Add a call to image()->stopAnimation() without
1537         checking the return of image() since it will return the nullImage() if
1538         the image not available. There is no need to check m_cachedImage before 
1539         calling image() because image() does not check or access m_cachedImage.
1540
1541         If m_styleImage is not a CachedStyleImage but m_cachedImage is not null,
1542         we need to remove m_renderer from the set of the clients of this m_cachedImage.
1543
1544         (WebCore::RenderImageResourceStyleImage::image const): The base class method
1545         RenderImageResource::image() returns the nullImage() if the image not
1546         available. This is because CachedImage::imageForRenderer() returns
1547         the nullImage() if the image is not available; see CachedImage.h. We should
1548         do the same for the derived class for consistency.
1549
1550 2017-08-04  Jeremy Jones  <jeremyj@apple.com>
1551
1552         Use MPAVRoutingController instead of deprecated versions.
1553         https://bugs.webkit.org/show_bug.cgi?id=175063
1554
1555         Reviewed by Tim Horton.
1556
1557         No new tests because no behavior change. This uses a different platform class to present
1558         an interface.
1559
1560         Remove deprecated MPAudioVideoRoutingPopoverController and MPAVRoutingSheet
1561         Add MPMediaControlsViewController.
1562
1563         * platform/spi/ios/MediaPlayerSPI.h:
1564
1565 2017-08-04  Matt Baker  <mattbaker@apple.com>
1566
1567         Web Inspector: REGRESSION (r220233): Check for null pointer passed to WebGLRenderingContextBase::deleteProgram
1568         https://bugs.webkit.org/show_bug.cgi?id=175196
1569         <rdar://problem/33727603>
1570
1571         Reviewed by Devin Rousso.
1572
1573         * html/canvas/WebGLRenderingContextBase.cpp:
1574         (WebCore::WebGLRenderingContextBase::deleteProgram):
1575
1576 2017-08-04  Matt Lewis  <jlewis3@apple.com>
1577
1578         Unreviewed, rolling out r220271.
1579
1580         Rolling out due to Layout Test failing on iOS Simulator.
1581
1582         Reverted changeset:
1583
1584         "Remove STREAMS_API compilation guard"
1585         https://bugs.webkit.org/show_bug.cgi?id=175165
1586         http://trac.webkit.org/changeset/220271
1587
1588 2017-08-03  Sam Weinig  <sam@webkit.org>
1589
1590         [Cleanup] Remove ScriptGlobalObject
1591         https://bugs.webkit.org/show_bug.cgi?id=175173
1592
1593         Reviewed by Darin Adler.
1594
1595         ScriptGlobalObject's two functions were only being used in
1596         four places. Three of those uses (ScriptGlobalObject::set in 
1597         InspectorFrontendClientLocal, WebInspectorUI, and RemoteWebInspectorUI)
1598         were merged into the new function addSelfToGlobalObjectInWorld on
1599         InspectorFrontendHost. The remaining function (ScriptGlobalObject::get
1600         in InspectorFrontendHost) was easily inlined.
1601
1602         * CMakeLists.txt:
1603         * WebCore.xcodeproj/project.pbxproj:
1604         * bindings/js/JSBindingsAllInOne.cpp:
1605         * bindings/js/ScriptGlobalObject.cpp: Removed.
1606         * bindings/js/ScriptGlobalObject.h: Removed.
1607         Removed ScriptGlobalObject.
1608
1609         * inspector/InspectorFrontendClientLocal.cpp:
1610         (WebCore::InspectorFrontendClientLocal::windowObjectCleared):
1611         Remove call to ScriptGlobalObject::set and use addSelfToGlobalObjectInWorld instead.
1612
1613         * inspector/InspectorFrontendHost.h:
1614         * inspector/InspectorFrontendHost.cpp:
1615         (WebCore::InspectorFrontendHost::showContextMenu):
1616         Inline ScriptGlobalObject::get.
1617
1618         (WebCore::InspectorFrontendHost::addSelfToGlobalObjectInWorld):
1619         Add helper which inlines ScriptGlobalObject::set and works
1620         as a helper for the three inspector frontends.
1621
1622 2017-08-04  Ryan Haddad  <ryanhaddad@apple.com>
1623
1624         Unreviewed, rolling out r220268.
1625
1626         This change caused assertion failures on macOS and iOS Debug
1627         WK2.
1628
1629         Reverted changeset:
1630
1631         "Resource Load Statistics: Report user interaction
1632         immediately, but only when needed"
1633         https://bugs.webkit.org/show_bug.cgi?id=175090
1634         http://trac.webkit.org/changeset/220268
1635
1636 2017-08-04  Youenn Fablet  <youenn@apple.com>
1637
1638         Remove STREAMS_API compilation guard
1639         https://bugs.webkit.org/show_bug.cgi?id=175165
1640
1641         Reviewed by Darin Adler.
1642
1643         No change of behavior.
1644
1645         * Configurations/FeatureDefines.xcconfig:
1646         * Modules/fetch/FetchBody.cpp:
1647         (WebCore::FetchBody::consumeAsStream):
1648         * Modules/fetch/FetchBody.h:
1649         * Modules/fetch/FetchBodyOwner.cpp:
1650         (WebCore::FetchBodyOwner::isDisturbedOrLocked const):
1651         (WebCore::FetchBodyOwner::blobLoadingSucceeded):
1652         (WebCore::FetchBodyOwner::blobLoadingFailed):
1653         (WebCore::FetchBodyOwner::blobChunk):
1654         * Modules/fetch/FetchBodyOwner.h:
1655         * Modules/fetch/FetchResponse.cpp:
1656         (WebCore::FetchResponse::BodyLoader::didSucceed):
1657         (WebCore::FetchResponse::BodyLoader::didFail):
1658         (WebCore::FetchResponse::BodyLoader::didReceiveData):
1659         * Modules/fetch/FetchResponse.h:
1660         * Modules/fetch/FetchResponse.idl:
1661         * Modules/fetch/FetchResponse.js:
1662         (initializeFetchResponse):
1663         * Modules/fetch/FetchResponseSource.cpp:
1664         * Modules/fetch/FetchResponseSource.h:
1665         * Modules/streams/ByteLengthQueuingStrategy.idl:
1666         * Modules/streams/ByteLengthQueuingStrategy.js:
1667         * Modules/streams/CountQueuingStrategy.idl:
1668         * Modules/streams/CountQueuingStrategy.js:
1669         * Modules/streams/ReadableByteStreamController.idl:
1670         * Modules/streams/ReadableByteStreamController.js:
1671         * Modules/streams/ReadableByteStreamInternals.js:
1672         * Modules/streams/ReadableStream.idl:
1673         * Modules/streams/ReadableStream.js:
1674         * Modules/streams/ReadableStreamBYOBReader.idl:
1675         * Modules/streams/ReadableStreamBYOBReader.js:
1676         * Modules/streams/ReadableStreamBYOBRequest.idl:
1677         * Modules/streams/ReadableStreamBYOBRequest.js:
1678         * Modules/streams/ReadableStreamDefaultController.idl:
1679         * Modules/streams/ReadableStreamDefaultController.js:
1680         * Modules/streams/ReadableStreamDefaultReader.idl:
1681         * Modules/streams/ReadableStreamDefaultReader.js:
1682         * Modules/streams/ReadableStreamInternals.js:
1683         * Modules/streams/ReadableStreamSource.h:
1684         * Modules/streams/ReadableStreamSource.idl:
1685         * Modules/streams/StreamInternals.js:
1686         * Modules/streams/WritableStream.idl:
1687         * Modules/streams/WritableStream.js:
1688         * Modules/streams/WritableStreamInternals.js:
1689         * bindings/js/JSDOMGlobalObject.cpp:
1690         (WebCore::isReadableByteStreamAPIEnabled):
1691         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1692         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
1693         * bindings/js/JSReadableStreamPrivateConstructors.h:
1694         * bindings/js/JSReadableStreamSourceCustom.cpp:
1695         * bindings/js/ReadableStreamDefaultController.cpp:
1696         * bindings/js/ReadableStreamDefaultController.h:
1697         * page/RuntimeEnabledFeatures.h:
1698         * testing/Internals.cpp:
1699         * testing/Internals.h:
1700         * testing/Internals.idl:
1701
1702 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1703
1704         [EME][GStreamer] Register ClearKey CDMFactory
1705         https://bugs.webkit.org/show_bug.cgi?id=175136
1706
1707         Reviewed by Xabier Rodriguez-Calvar.
1708
1709         Register the ClearKey CDM factory in CDMFactoryGStreamer. A CDMFactoryClearKey
1710         singleton object is introduced and used for that registration.
1711
1712         The basic CDMFactoryClearKey and CDMPrivateClearKey methods are implemented,
1713         marking `org.w3.clearkey` as the supported key system and `keyids` as the
1714         supported init data type. Additional logic around key system configurations,
1715         distinctive identifiers, persistent state and related restrictions and
1716         requirements is implemented.
1717
1718         This improves the ClearKey EME tests a bit, now progressing to the point of
1719         failing with a NotAllowedError exception due to the CDMInstance object failing
1720         to properly initialize because of missing implementation.
1721
1722         No new tests -- relevant tests have underlying baselines updated to reflect
1723         changes in behavior.
1724
1725         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1726         (WebCore::CDMFactoryClearKey::singleton):
1727         (WebCore::CDMFactoryClearKey::supportsKeySystem):
1728         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
1729         (WebCore::CDMPrivateClearKey::supportsConfiguration const):
1730         (WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions const):
1731         (WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration const):
1732         (WebCore::CDMPrivateClearKey::supportsRobustness const):
1733         (WebCore::CDMPrivateClearKey::distinctiveIdentifiersRequirement const):
1734         (WebCore::CDMPrivateClearKey::persistentStateRequirement const):
1735         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1736         * platform/graphics/gstreamer/eme/CDMFactoryGStreamer.cpp:
1737         (WebCore::CDMFactory::platformRegisterFactories):
1738
1739 2017-08-04  John Wilander  <wilander@apple.com>
1740
1741         Resource Load Statistics: Report user interaction immediately, but only when needed
1742         https://bugs.webkit.org/show_bug.cgi?id=175090
1743         <rdar://problem/33685546>
1744
1745         Reviewed by Chris Dumez.
1746
1747         Test: http/tests/loading/resourceLoadStatistics/user-interaction-only-reported-once-within-short-period-of-time.html
1748
1749         * loader/ResourceLoadObserver.cpp:
1750         (WebCore::ResourceLoadObserver::ResourceLoadObserver):
1751         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1752             Now tells the UI process immediately but also records that it has
1753             done so to avoid doing it when not needed.
1754         (WebCore::ResourceLoadObserver::scheduleNotificationIfNeeded):
1755             Conditional throttling gone, now always throttles.
1756         (WebCore::ResourceLoadObserver::notifyObserver):
1757             Renamed from ResourceLoadObserver::notificationTimerFired().
1758         (WebCore::ResourceLoadObserver::clearState):
1759             New function to allow the test runner to reset the web process'
1760             statistics state now that we keep track of whether or not we've
1761             reported user interaction to the UI process.
1762         (WebCore::ResourceLoadObserver::setShouldThrottleObserverNotifications): Deleted.
1763         (WebCore::ResourceLoadObserver::notificationTimerFired): Deleted.
1764         * loader/ResourceLoadObserver.h:
1765         (): Deleted.
1766         * testing/Internals.cpp:
1767         (WebCore::Internals::resetToConsistentState):
1768         (WebCore::Internals::setResourceLoadStatisticsShouldThrottleObserverNotifications): Deleted.
1769             No longer needed since user interaction is always communicated
1770             immediately.
1771         * testing/Internals.h:
1772         * testing/Internals.idl:
1773
1774 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1775
1776         [EME] Push CDMFactory into the platform layer
1777         https://bugs.webkit.org/show_bug.cgi?id=175129
1778
1779         Reviewed by Xabier Rodriguez-Calvar.
1780
1781         This is a follow-up to r219678 that moved the majority of CDM abstraction
1782         classes into the platform layer, but missed the CDMFactory class.
1783
1784         The CDMFactory abstraction is now also placed in the platform layer. Only
1785         change to the interface is that the createCDM() method can't accept a CDM
1786         object reference anymore since that class is cemented into the WebCore
1787         layer, and no current implementation used it anyway.
1788
1789         Additionally, the static Vector object of registered factories is moved
1790         under the CDMFactory class, along with the register and unregister
1791         functions. The platformRegisterFactories() function is added to allow for
1792         platform-specific factory registrations to occur when the registered
1793         factories are queried for the first time. Empty implementation for this
1794         function is provided for non-GStreamer platforms, while for GStreamer
1795         the implementation is kept in CDMFactoryGStreamer.cpp. It's still empty
1796         for now, but it will register the ClearKey factory there in the near
1797         future.
1798
1799         No new tests -- none affected, only refactoring.
1800
1801         * CMakeLists.txt:
1802         * Modules/encryptedmedia/CDM.cpp:
1803         (WebCore::createCDMPrivateForKeySystem):
1804         (WebCore::CDM::supportsKeySystem):
1805         (WebCore::CDM::CDM):
1806         (): Deleted.
1807         (WebCore::CDM::registerCDMFactory): Deleted.
1808         (WebCore::CDM::unregisterCDMFactory): Deleted.
1809         * Modules/encryptedmedia/CDM.h:
1810         (WebCore::CDMFactory::~CDMFactory): Deleted.
1811         * PlatformWPE.cmake:
1812         * platform/GStreamer.cmake:
1813         * platform/encryptedmedia/CDMFactory.cpp: Added.
1814         (WebCore::CDMFactory::registerFactory):
1815         (WebCore::CDMFactory::unregisterFactory):
1816         (WebCore::CDMFactory::platformRegisterFactories):
1817         * platform/encryptedmedia/CDMFactory.h: Added.
1818         (WebCore::CDMFactory::~CDMFactory):
1819         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1820         (WebCore::CDMFactoryClearKey::createCDM):
1821         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1822         * platform/encryptedmedia/gstreamer/CDMFactoryGStreamer.cpp: Added.
1823         (WebCore::CDMFactory::platformRegisterFactories):
1824         * testing/MockCDMFactory.cpp:
1825         (WebCore::m_weakPtrFactory):
1826         (WebCore::MockCDMFactory::unregister):
1827         (WebCore::MockCDMFactory::createCDM):
1828         * testing/MockCDMFactory.h:
1829
1830 2017-08-04  Frederic Wang  <fwang@igalia.com>
1831
1832         ScrollingTreeOverflowScrollingNodeIOS uses the wrong fixed position rectangle
1833         https://bugs.webkit.org/show_bug.cgi?id=175135
1834
1835         Reviewed by Simon Fraser.
1836
1837         This patch modifies ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll so
1838         that it uses the fixed position rectangle relative of the first frame ancestor instead of
1839         the one of the main frame. This makes it consistent with ScrollingTreeFrameScrollingNodeIOS
1840         and RenderLayerCompositor. This fixes some flickering issues on iOS.
1841
1842         Test: fast/scrolling/ios/fixed-inside-overflow-inside-iframe.html
1843
1844         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1845         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Helper function to get the
1846         fixed position rect to use for that frame.
1847         * page/scrolling/ScrollingTreeNode.cpp:
1848         (WebCore::ScrollingTreeNode::enclosingFrameNode const): Helper function to get the enclosing
1849         frame for this scrolling node or null if there is none.
1850         * page/scrolling/ScrollingTreeNode.h: Declare enclosingFrameNode.
1851
1852 2017-08-04  Zan Dobersek  <zdobersek@igalia.com>
1853
1854         Unreviewed. Removing redundant NotImplemented.h header inclusions
1855         and cleaning up whitespace issues in libgcrypt-specific CryptoKeyEC
1856         and CryptoKeyRSA implementation files.
1857
1858         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1859         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1860
1861 2017-08-04  Jeremy Jones  <jeremyj@apple.com>
1862
1863         Remove unnecesary call to status bar SPI.
1864         https://bugs.webkit.org/show_bug.cgi?id=175176
1865         rdar://problem/20887306
1866
1867         Reviewed by Darin Adler.
1868
1869         No new tests because no behavior change.
1870
1871         This removes an obsolete call to SPI.
1872
1873         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1874         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
1875
1876 2017-08-03  Zan Dobersek  <zdobersek@igalia.com>
1877
1878         [GCrypt] Implement CryptoKeyEC PKCS#8 imports
1879         https://bugs.webkit.org/show_bug.cgi?id=173647
1880
1881         Reviewed by Jiewen Tan.
1882
1883         No new tests -- affected tests are now passing and are unskipped.
1884
1885         Implement libgcrypt-based support for PKCS#8 imports of EC keys.
1886
1887         Existing libtasn1 utilities are used to achieve this. First, the provided key data
1888         is decoded against the PrivateKeyInfo ASN.1 definition. First, the version member
1889         of that structure is validated, followed by the algorithm member. The latter is
1890         also properly tested depending on this being an import of an ECDSA or ECDH key.
1891
1892         Data of the parameters member is decoded against the ECParameters ASN.1 definition,
1893         and the namedCurve object identifier is validated, making sure it represents a
1894         valid EC curve and that this curve maches the one specified for the import
1895         operation.
1896
1897         Data of the privateKey member is decoded against the ECPrivateKey ASN.1 definition.
1898         The version member of that structure is properly validated. The optional parameters
1899         member of that structure is already decoded against the ECParameters ASN.1
1900         definition. If present, it is checked to contain a valid EC curve identifier that
1901         matches the specified curve.
1902
1903         The optional publicKey member of the ECPrivateKey structure is validated, testing
1904         that its data matches in size an uncompressed EC point, and that the first byte
1905         of this data is 0x04, as expected for an uncompressed EC point.
1906
1907         What's left is the private key data on the initial ECPrivateKey structure. That
1908         data is retrieved and validated, making sure its size matches the size of the
1909         specified curve. The `private-key` s-expression is then constructed, embedding
1910         the curve name and the validated private key data. This s-expression is then used
1911         to construct an EC context.
1912
1913         If the optional publicKey data was provided, it's used to set the `q` parameter
1914         for this EC context. Otherwise, the value for `q` is computed on-the-fly for the
1915         specified EC and the provided private key. The `q` point is then tested through
1916         the gcry_mpi_ec_curve_point() function, making sure that the derived point is
1917         indeed located on the given EC.
1918
1919         Finally, with the private key properly validated, a new CryptoKeyEC object is
1920         constructed, using the `private-key` s-expression and the parameters that were
1921         specified for this import operation.
1922
1923         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
1924         (WebCore::CryptoKeyEC::platformImportPkcs8):
1925         * crypto/gcrypt/GCryptUtilities.h:
1926
1927 2017-08-03  Chris Dumez  <cdumez@apple.com>
1928
1929         Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without a leading 0
1930         https://bugs.webkit.org/show_bug.cgi?id=175132
1931
1932         Reviewed by Darin Adler.
1933
1934         Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.', without
1935         a leading 0. This is as per https://github.com/whatwg/html/pull/2852.
1936
1937         The latest spec is at:
1938         - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
1939
1940         Test: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
1941
1942         * html/parser/HTMLParserIdioms.cpp:
1943         (WebCore::parseHTTPRefreshInternal):
1944
1945 2017-08-03  Brian Burg  <bburg@apple.com>
1946
1947         Remove ENABLE(WEB_SOCKET) guards
1948         https://bugs.webkit.org/show_bug.cgi?id=167044
1949
1950         Reviewed by Joseph Pecoraro.
1951
1952         * Configurations/FeatureDefines.xcconfig:
1953         * Modules/websockets/ThreadableWebSocketChannel.cpp:
1954         * Modules/websockets/ThreadableWebSocketChannel.h:
1955         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
1956         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
1957         * Modules/websockets/WebSocket.cpp:
1958         * Modules/websockets/WebSocket.h:
1959         * Modules/websockets/WebSocket.idl:
1960         * Modules/websockets/WebSocketChannel.cpp:
1961         * Modules/websockets/WebSocketChannel.h:
1962         * Modules/websockets/WebSocketChannelClient.h:
1963         * Modules/websockets/WebSocketDeflateFramer.cpp:
1964         * Modules/websockets/WebSocketDeflateFramer.h:
1965         * Modules/websockets/WebSocketDeflater.cpp:
1966         * Modules/websockets/WebSocketDeflater.h:
1967         * Modules/websockets/WebSocketExtensionDispatcher.cpp:
1968         * Modules/websockets/WebSocketExtensionDispatcher.h:
1969         * Modules/websockets/WebSocketExtensionParser.cpp:
1970         * Modules/websockets/WebSocketExtensionParser.h:
1971         * Modules/websockets/WebSocketExtensionProcessor.h:
1972         * Modules/websockets/WebSocketFrame.cpp:
1973         * Modules/websockets/WebSocketFrame.h:
1974         * Modules/websockets/WebSocketHandshake.cpp:
1975         * Modules/websockets/WebSocketHandshake.h:
1976         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
1977         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
1978         * dom/Document.cpp:
1979         (WebCore::Document::Document):
1980         (WebCore::Document::idbConnectionProxy):
1981         (WebCore::Document::socketProvider):
1982         * dom/Document.h:
1983         * dom/ScriptExecutionContext.h:
1984         * inspector/InspectorInstrumentation.cpp:
1985         (WebCore::InspectorInstrumentation::didSendWebSocketFrameImpl):
1986         * inspector/InspectorInstrumentation.h:
1987         (WebCore::InspectorInstrumentation::didSendWebSocketFrame):
1988         * inspector/InspectorNetworkAgent.cpp:
1989         * inspector/InspectorNetworkAgent.h:
1990         * page/RuntimeEnabledFeatures.cpp:
1991         (WebCore::RuntimeEnabledFeatures::webSocketEnabled const):
1992         * page/RuntimeEnabledFeatures.h:
1993         * page/SocketProvider.cpp:
1994         * page/SocketProvider.h:
1995         * workers/WorkerGlobalScope.cpp:
1996         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
1997         * workers/WorkerGlobalScope.h:
1998         * workers/WorkerMessagingProxy.cpp:
1999         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2000         * workers/WorkerThread.cpp:
2001         (WebCore::WorkerThread::WorkerThread):
2002         (WebCore::WorkerThread::socketProvider):
2003         * workers/WorkerThread.h:
2004
2005 2017-08-03  Don Olmstead  <don.olmstead@sony.com>
2006
2007         Remove LayoutUnit dependency in TextStream
2008         https://bugs.webkit.org/show_bug.cgi?id=175110
2009
2010         Reviewed by Zalan Bujtas.
2011
2012         No new tests. No change in behavior.
2013
2014         * CMakeLists.txt:
2015         * WebCore.xcodeproj/project.pbxproj:
2016         * platform/LayoutUnit.cpp: Added.
2017         (WebCore::operator<<):
2018         * platform/LayoutUnit.h:
2019         * platform/text/TextStream.cpp:
2020         * platform/text/TextStream.h:
2021
2022 2017-08-03  Jeremy Jones  <jeremyj@apple.com>
2023
2024         Improve WebKitLegacy video fullscreen animation begin and end rects.
2025         https://bugs.webkit.org/show_bug.cgi?id=175152
2026         rdar://problem/32840576
2027
2028         Reviewed by Eric Carlson.
2029
2030         No new tests, becuase this change has no effect on the DOM.
2031
2032         This change uses different rects for fullscreen animation to prevent the animation
2033         from failing, and to improve the aesthetics of the animation.
2034
2035         * platform/mac/WebVideoFullscreenController.mm:
2036         (frameExpandedToRatioOfFrame):
2037         (-[WebVideoFullscreenController enterFullscreen:]):
2038         (-[WebVideoFullscreenController exitFullscreen]):
2039         (-[WebVideoFullscreenWindow animateFromRect:toRect:withSubAnimation:controllerAction:]):
2040         (constrainFrameToRatioOfFrame): Deleted.
2041
2042 2017-08-03  Jer Noble  <jer.noble@apple.com>
2043
2044         [EME][Mac] SecureStop left on disk in Private Browsing mode.
2045         https://bugs.webkit.org/show_bug.cgi?id=175162
2046
2047         Reviewed by Eric Carlson.
2048
2049         Return an empty string from mediaKeysStorageDirectory() when the page indicates that storage should
2050         be ephemeral(). Previously, an empty string in this case would be treated as an error. Instead, treat
2051         an empty string as valid, and do not try to store or retrieve session information to disk in that case.
2052
2053         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2054         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory const):
2055         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
2056         (WebCore::CDMSessionAVContentKeySession::releaseKeys):
2057         (WebCore::CDMSessionAVContentKeySession::update):
2058         (WebCore::CDMSessionAVContentKeySession::generateKeyReleaseMessage):
2059         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
2060         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
2061         (WebCore::CDMSessionMediaSourceAVFObjC::storagePath const):
2062
2063 2017-08-03  Youenn Fablet  <youenn@apple.com>
2064
2065         [Fetch API] Add support for Request keepalive getter
2066         https://bugs.webkit.org/show_bug.cgi?id=175151
2067
2068         Reviewed by Chris Dumez.
2069
2070         Test: imported/w3c/web-platform-tests/fetch/api/request/request-keepalive.html
2071
2072         Adding keepalive as a fetch option.
2073         Adding initialization and getter of keepalive into FetchRequest.
2074
2075         * Modules/fetch/FetchRequest.cpp:
2076         (WebCore::buildOptions):
2077         * Modules/fetch/FetchRequest.h:
2078         * Modules/fetch/FetchRequest.idl:
2079         * loader/FetchOptions.h:
2080
2081 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
2082
2083         [PAL] Move spi/cf directory into PAL
2084         https://bugs.webkit.org/show_bug.cgi?id=175057
2085
2086         Reviewed by Antti Koivisto.
2087
2088         * WebCore.xcodeproj/project.pbxproj:
2089         * loader/cocoa/DiskCacheMonitorCocoa.mm:
2090         * loader/cocoa/SubresourceLoaderCocoa.mm:
2091         * loader/mac/ResourceLoaderMac.mm:
2092         * platform/cf/CoreMediaSoftLink.cpp:
2093         * platform/cf/CoreMediaSoftLink.h:
2094         * platform/mac/PluginBlacklist.mm:
2095         * platform/mac/WebCoreNSStringExtras.mm:
2096         * platform/mac/WebGLBlacklist.mm:
2097         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2098         * platform/network/NetworkStorageSession.h:
2099         * platform/network/cf/CookieJarCFNet.cpp:
2100         * platform/network/cf/CredentialStorageCFNet.cpp:
2101         * platform/network/cf/ResourceHandleCFNet.cpp:
2102         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
2103         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2104         * platform/network/cf/ResourceRequestCFNet.cpp:
2105         * platform/network/cf/ResourceRequestCFNet.h:
2106         * platform/network/cf/ResourceResponse.h:
2107         * platform/network/cf/ResourceResponseCFNet.cpp:
2108         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2109         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2110         * platform/network/cocoa/CookieStorageObserver.h:
2111         * platform/network/cocoa/CredentialCocoa.h:
2112         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2113         * platform/network/cocoa/ResourceRequestCocoa.mm:
2114         * platform/network/cocoa/ResourceResponseCocoa.mm:
2115         * platform/network/ios/ResourceRequestIOS.mm:
2116         * platform/network/mac/CookieJarMac.mm:
2117         * platform/network/mac/FormDataStreamMac.mm:
2118         * platform/network/mac/ResourceHandleMac.mm:
2119         * platform/network/mac/ResourceRequestMac.mm:
2120         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2121         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2122         * platform/network/mac/WebCoreURLResponse.h:
2123         * testing/cocoa/WebArchiveDumpSupport.mm:
2124
2125 2017-08-03  Youenn Fablet  <youenn@apple.com>
2126
2127         Remove FETCH_API compilation guard
2128         https://bugs.webkit.org/show_bug.cgi?id=175154
2129
2130         Reviewed by Chris Dumez.
2131
2132         No change of behavior.
2133
2134         * Configurations/FeatureDefines.xcconfig:
2135         * Modules/fetch/DOMWindowFetch.cpp:
2136         * Modules/fetch/DOMWindowFetch.h:
2137         * Modules/fetch/DOMWindowFetch.idl:
2138         * Modules/fetch/FetchBody.cpp:
2139         * Modules/fetch/FetchBody.h:
2140         * Modules/fetch/FetchBody.idl:
2141         * Modules/fetch/FetchBodyConsumer.cpp:
2142         * Modules/fetch/FetchBodyConsumer.h:
2143         * Modules/fetch/FetchBodyOwner.cpp:
2144         * Modules/fetch/FetchBodyOwner.h:
2145         * Modules/fetch/FetchHeaders.cpp:
2146         * Modules/fetch/FetchHeaders.h:
2147         * Modules/fetch/FetchHeaders.idl:
2148         * Modules/fetch/FetchInternals.js:
2149         * Modules/fetch/FetchLoader.cpp:
2150         * Modules/fetch/FetchLoader.h:
2151         * Modules/fetch/FetchLoaderClient.h:
2152         * Modules/fetch/FetchRequest.cpp:
2153         * Modules/fetch/FetchRequest.h:
2154         * Modules/fetch/FetchRequest.idl:
2155         * Modules/fetch/FetchResponse.cpp:
2156         * Modules/fetch/FetchResponse.h:
2157         * Modules/fetch/FetchResponse.idl:
2158         * Modules/fetch/FetchResponse.js:
2159         * Modules/fetch/FetchResponseSource.cpp:
2160         * Modules/fetch/FetchResponseSource.h:
2161         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
2162         * Modules/fetch/WorkerGlobalScopeFetch.h:
2163         * Modules/fetch/WorkerGlobalScopeFetch.idl:
2164         * page/RuntimeEnabledFeatures.h:
2165         (WebCore::RuntimeEnabledFeatures::fetchAPIEnabled const):
2166
2167 2017-08-03  Devin Rousso  <drousso@apple.com>
2168
2169         Web Inspector: add button to open Inspector^2
2170         https://bugs.webkit.org/show_bug.cgi?id=175108
2171
2172         Reviewed by Brian Burg.
2173
2174         This patch just exposes a function to the inspector page. No new functionality was added.
2175
2176         * inspector/InspectorFrontendHost.idl:
2177         * inspector/InspectorFrontendHost.h:
2178         * inspector/InspectorFrontendHost.cpp:
2179         (WebCore::InspectorFrontendHost::inspectInspector):
2180
2181 2017-08-03  Matt Baker  <mattbaker@apple.com>
2182
2183         Web Inspector: Instrument WebGLProgram created/deleted
2184         https://bugs.webkit.org/show_bug.cgi?id=175059
2185
2186         Reviewed by Devin Rousso.
2187
2188         Tests: inspector/canvas/shaderProgram-add-remove-webgl.html
2189                inspector/canvas/shaderProgram-add-remove-webgl2.html
2190
2191         This patch adds instrumentation to WebGLRenderingContextBase for tracking
2192         WebGLPrograms. A new helper class, InspectorShaderProgram, is used by
2193         the CanvasAgent to hold related data.
2194
2195         * CMakeLists.txt:
2196         * WebCore.xcodeproj/project.pbxproj:
2197
2198         * html/canvas/WebGLRenderingContextBase.cpp:
2199         (WebCore::WebGLRenderingContextBase::createProgram):
2200         (WebCore::WebGLRenderingContextBase::deleteProgram):
2201
2202         * inspector/InspectorCanvasAgent.cpp:
2203         (WebCore::InspectorCanvasAgent::enable):
2204         (WebCore::InspectorCanvasAgent::frameNavigated):
2205         (WebCore::InspectorCanvasAgent::didCreateProgram):
2206         (WebCore::InspectorCanvasAgent::willDeleteProgram):
2207         (WebCore::InspectorCanvasAgent::clearCanvasData):
2208         (WebCore::InspectorCanvasAgent::unbindCanvas):
2209         (WebCore::InspectorCanvasAgent::unbindProgram):
2210         (WebCore::InspectorCanvasAgent::assertInspectorProgram):
2211         (WebCore::InspectorCanvasAgent::findInspectorProgram):
2212         * inspector/InspectorCanvasAgent.h:
2213
2214         * inspector/InspectorInstrumentation.cpp:
2215         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl):
2216         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
2217         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
2218         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
2219         (WebCore::InspectorInstrumentation::recordCanvasActionImpl):
2220         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
2221         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
2222         (WebCore::InspectorInstrumentation::willDeleteProgramImpl):
2223
2224         * inspector/InspectorInstrumentation.h:
2225         (WebCore::InspectorInstrumentation::recordCanvasActionImpl):
2226         (WebCore::InspectorInstrumentation::didCreateCSSCanvas):
2227         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
2228         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2229         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
2230         (WebCore::InspectorInstrumentation::recordCanvasAction):
2231         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
2232         (WebCore::InspectorInstrumentation::didCreateProgram):
2233         (WebCore::InspectorInstrumentation::willDeleteProgram):
2234
2235         * inspector/InspectorShaderProgram.cpp: Added.
2236         (WebCore::InspectorShaderProgram::create):
2237         (WebCore::InspectorShaderProgram::InspectorShaderProgram):
2238         (WebCore::InspectorShaderProgram::context const):
2239         * inspector/InspectorShaderProgram.h: Added.
2240
2241 2017-08-03  Matt Lewis  <jlewis3@apple.com>
2242
2243         Unreviewed, rolling out r220209.
2244
2245         This caused internal build failures.
2246
2247         Reverted changeset:
2248
2249         "Use MPAVRoutingController instead of deprecated versions."
2250         https://bugs.webkit.org/show_bug.cgi?id=175063
2251         http://trac.webkit.org/changeset/220209
2252
2253 2017-08-03  Brady Eidson  <beidson@apple.com>
2254
2255         Add SW IDLs and stub out basic functionality.
2256         https://bugs.webkit.org/show_bug.cgi?id=175115
2257
2258         Reviewed by Chris Dumez.
2259
2260         No new tests (Currently no behavior change).
2261
2262         Overall note: This feature is EnabledAtRuntime as opposed to EnabledBySetting because
2263         the Settings-based code generation is completely broken for non-Document contexts,
2264         whereas the RuntimeEnabledFeatures-based generation is not.
2265     
2266         * CMakeLists.txt:
2267         * Configurations/FeatureDefines.xcconfig:
2268         * DerivedSources.make:
2269         * WebCore.xcodeproj/project.pbxproj:
2270
2271         * bindings/scripts/preprocess-idls.pl: Handle the new global scope c'tor file.
2272
2273         * bindings/js/JSServiceWorkerContainerCustom.cpp: Added.
2274         (WebCore::JSServiceWorkerContainer::ready const):
2275
2276         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2277         (WebCore::toJSWorkerGlobalScope): Refactor to handle both types of derived workers.
2278         (WebCore::toJSServiceWorkerGlobalScope):
2279         * bindings/js/JSWorkerGlobalScopeBase.h:
2280
2281         * dom/EventNames.h:
2282         * dom/EventTargetFactory.in:
2283
2284         * features.json: Change status of feature.
2285
2286         * page/Navigator.idl:
2287         * page/NavigatorBase.cpp:
2288         (WebCore::NavigatorBase::serviceWorker):
2289         * page/NavigatorBase.h:
2290         * page/NavigatorServiceWorker.idl: Added.
2291
2292         * page/RuntimeEnabledFeatures.h:
2293         (WebCore::RuntimeEnabledFeatures::serviceWorkerEnabled const):
2294         (WebCore::RuntimeEnabledFeatures::setServiceWorkerEnabled):
2295
2296         * workers/ServiceWorker.cpp: Added.
2297         (WebCore::ServiceWorker::postMessage):
2298         (WebCore::ServiceWorker::~ServiceWorker):
2299         (WebCore::ServiceWorker::scriptURL const):
2300         (WebCore::ServiceWorker::state const):
2301         (WebCore::ServiceWorker::eventTargetInterface const):
2302         (WebCore::ServiceWorker::scriptExecutionContext const):
2303         * workers/ServiceWorker.h: Added.
2304         * workers/ServiceWorker.idl: Added.
2305
2306         * workers/ServiceWorkerContainer.cpp: Added.
2307         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
2308         (WebCore::ServiceWorkerContainer::controller const):
2309         (WebCore::ServiceWorkerContainer::ready):
2310         (WebCore::ServiceWorkerContainer::addRegistration):
2311         (WebCore::ServiceWorkerContainer::getRegistration):
2312         (WebCore::ServiceWorkerContainer::getRegistrations):
2313         (WebCore::ServiceWorkerContainer::startMessages):
2314         (WebCore::ServiceWorkerContainer::eventTargetInterface const):
2315         (WebCore::ServiceWorkerContainer::scriptExecutionContext const):
2316         * workers/ServiceWorkerContainer.h: Added.
2317         * workers/ServiceWorkerContainer.idl: Added.
2318
2319         * workers/ServiceWorkerGlobalScope.cpp: Added.
2320         (WebCore::ServiceWorkerGlobalScope::registration):
2321         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
2322         * workers/ServiceWorkerGlobalScope.h: Added.
2323         * workers/ServiceWorkerGlobalScope.idl: Added.
2324
2325         * workers/ServiceWorkerRegistration.cpp: Added.
2326         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2327         (WebCore::ServiceWorkerRegistration::installing):
2328         (WebCore::ServiceWorkerRegistration::waiting):
2329         (WebCore::ServiceWorkerRegistration::active):
2330         (WebCore::ServiceWorkerRegistration::scope const):
2331         (WebCore::ServiceWorkerRegistration::update):
2332         (WebCore::ServiceWorkerRegistration::unregister):
2333         (WebCore::ServiceWorkerRegistration::eventTargetInterface const):
2334         (WebCore::ServiceWorkerRegistration::scriptExecutionContext const):
2335         * workers/ServiceWorkerRegistration.h: Added.
2336         * workers/ServiceWorkerRegistration.idl: Added.
2337
2338 2017-08-03  Yoshiaki Jitsukawa  <jitsu@rd.scei.sony.co.jp>
2339
2340         [WebCore] Sort Xcode project files
2341         https://bugs.webkit.org/show_bug.cgi?id=175121
2342
2343         Reviewed by Antti Koivisto.
2344
2345         * WebCore.xcodeproj/project.pbxproj:
2346
2347 2017-08-02  Sam Weinig  <sam@webkit.org>
2348
2349         [WebIDL] Convert MutationCallback to be a normal generated callback
2350         https://bugs.webkit.org/show_bug.cgi?id=174140
2351
2352         Reviewed by Darin Adler.
2353
2354         To make this work more nicely, I:
2355         - Added the ability to for non-nullable interfaces in sequences to be passed
2356           via a Ref<> rather than a RefPtr<> as a parameter to a callback function.
2357           (e.g. callback MyCallback = void (sequence<Foo> foos) will now have the 
2358           signature, CallbackResult<void> handleEvent(const Vector<Ref<Foo>>&) rather
2359           than CallbackResult<void> handleEvent(const Vector<RefPtr<Foo>>&).
2360         - Added a new extended attribute for callback functions called [CallbackThisObject=Type]
2361           which allows you to specify that the callback needs a this object in addition
2362           to its arguments. When specified, the first argument of the C++ implementation
2363           function will now correspond to the this object, with the remaining arguments
2364           shifted over one.
2365         - Converted callback objects to all inherit directly from ActiveDOMCallback rather
2366           than having the generated JS callback derived class inherit from it. This allows
2367           us to have access to a callback's canInvokeCallback() function anywhere (needed
2368           for MutationCallback) as well as giving a place to put an optional virtual 
2369           visitJSFunction to allow marking weak callbacks (while not an ideal layering, 
2370           this matches what we do in EventListener). This change requires each callback to
2371           have a bit more code to import the ActiveDOMCallback's constructor and requires
2372           non-JS derived callbacks to pass a ScriptExecutionContext (e.g. the Document).
2373
2374         * CMakeLists.txt:
2375         * DerivedSources.make:
2376         * WebCore.xcodeproj/project.pbxproj:
2377         * bindings/js/JSMutationCallback.cpp: Removed.
2378         * bindings/js/JSMutationCallback.h: Removed.
2379         Remove custom JSMutationCallback.h/cpp
2380
2381         * Modules/geolocation/PositionCallback.h:
2382         * Modules/geolocation/PositionErrorCallback.h:
2383         * Modules/notifications/NotificationPermissionCallback.h:
2384         * Modules/webaudio/AudioBufferCallback.h:
2385         * Modules/webdatabase/DatabaseCallback.h:
2386         * Modules/webdatabase/SQLStatementCallback.h:
2387         * Modules/webdatabase/SQLStatementErrorCallback.h:
2388         * Modules/webdatabase/SQLTransactionCallback.h:
2389         * Modules/webdatabase/SQLTransactionErrorCallback.h:
2390         * css/MediaQueryListListener.h:
2391         * dom/NodeFilter.h:
2392         * dom/RequestAnimationFrameCallback.h:
2393         * dom/StringCallback.h:
2394         * fileapi/BlobCallback.h:
2395         * html/VoidCallback.h:
2396         * page/IntersectionObserverCallback.h:
2397         * page/PerformanceObserverCallback.h:
2398         Add ActiveDOMCallback as a base class. Import the ActiveDOMCallback constructor.
2399
2400         * Modules/mediastream/MediaDevicesRequest.cpp:
2401         (WebCore::MediaDevicesRequest::filterDeviceList):
2402         (WebCore::MediaDevicesRequest::start):
2403         * Modules/mediastream/MediaDevicesRequest.h:
2404         Change filterDeviceList to take a Vector of Refs.
2405
2406         * bindings/IDLTypes.h:
2407         Add InnerParameterType and NullableInnerParameterType type hooks
2408         and specialize wrappers to use Ref for InnerParameterType, and RefPtr
2409         for NullableInnerParameterType.
2410
2411         * bindings/js/JSCallbackData.cpp:
2412         * bindings/js/JSCallbackData.h:
2413         Add support for passing a this object and give JSCallbackDataWeak a visitJSFunction
2414         to allow marking the underlying function.
2415
2416         * bindings/js/JSMutationObserverCustom.cpp:
2417         (WebCore::JSMutationObserver::visitAdditionalChildren):
2418         (WebCore::constructJSMutationObserver): Deleted.
2419         Remove the custom constructor and replace it with a custom visitAdditionalChildren
2420         that calls the new ActiveDOMObject's visitJSFunction.
2421
2422         * bindings/scripts/CodeGenerator.pm:
2423         (ParseType):
2424         Add helper to parse a type and cache the result.
2425
2426         * bindings/scripts/CodeGeneratorJS.pm:
2427         (GenerateCallbackHeaderContent):
2428         (GenerateCallbackImplementationContent):
2429         (GetJSCallbackDataType): Deleted.
2430         - Add support for [CallbackThisObject]. When [CallbackThisObject] is not specified, use jsUndefined() 
2431           as the this object as specified by WebIDL.
2432         - Stop inheriting from ActiveDOMCallback now that callbacks need to do this themselves.
2433         - Add a visitJSFunction override for weak callback functions which calls into the callback data.
2434
2435         * bindings/scripts/IDLAttributes.json:
2436         Add [CallbackThisObject].
2437
2438         * bindings/scripts/IDLParser.pm:
2439         (ParseType):
2440         Add entry point to parse a single type.
2441
2442         * css/FontFaceSet.h:
2443         Use Ref rather than RefPtr for the faces sequence.
2444
2445         * dom/ActiveDOMCallback.h:
2446         (WebCore::ActiveDOMCallback::visitJSFunction):
2447         Add an optional visitJSFunction virtual function so that derived classes
2448         have a way of marking underlying function objects.
2449
2450         * dom/MutationCallback.h:
2451         Convert to support generation (return a CallbackResult, inherit from ActiveDOMObject).
2452
2453         * dom/MutationCallback.idl: Added.
2454         Added to generate the callback. Uses the new [CallbackThisObject].
2455
2456         * dom/MutationObserver.cpp:
2457         (WebCore::MutationObserver::deliver):
2458         Switch to call idiomatic handleEvent, and pass *this as the first parameter
2459         which will be translated into the this object.
2460
2461         * dom/MutationObserver.h:
2462         (WebCore::MutationObserver::callback):
2463         Expose the callback so it can marked during GC.
2464
2465         * dom/MutationObserver.idl:
2466         Remove CustomConstructor and replace it with a custom mark function.
2467
2468         * dom/NativeNodeFilter.cpp:
2469         * dom/NativeNodeFilter.h:
2470         * inspector/InspectorDatabaseAgent.cpp:
2471         Pass now needed ScriptExecutionContext to non-js based callbacks.
2472
2473         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2474         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
2475         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: Added.
2476         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h: Added.
2477         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2478         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2479         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2480         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2481         * bindings/scripts/test/TestCallbackFunctionWithThisObject.idl: Added.
2482         * bindings/scripts/test/TestCallbackInterface.idl:
2483         Add/update tests.
2484
2485 2017-08-03  Jeremy Jones  <jeremyj@apple.com>
2486
2487         Use MPAVRoutingController instead of deprecated versions.
2488         https://bugs.webkit.org/show_bug.cgi?id=175063
2489
2490         Reviewed by Tim Horton.
2491
2492         No new tests because no behavior change. This uses a different platform class to present
2493         an interface.
2494
2495         Remove deprecated MPAudioVideoRoutingPopoverController and MPAVRoutingSheet
2496         Add MPMediaControlsViewController.
2497
2498         * platform/spi/ios/MediaPlayerSPI.h:
2499
2500 2017-08-03  Chris Dumez  <cdumez@apple.com>
2501
2502         Improve our support for referrer policies
2503         https://bugs.webkit.org/show_bug.cgi?id=175069
2504         <rdar://problem/33677313>
2505
2506         Reviewed by Darin Adler.
2507
2508         Improve our support for referrer policies. In particular, we now support the
2509         additional following ones: "same-origin", "origin-when-cross-origin" and
2510         "strict-origin-when-cross-origin".
2511
2512         This is as per the following specification:
2513         - https://www.w3.org/TR/referrer-policy/#referrer-policies
2514
2515         Also refactor the code a bit for clarity: I merged the ReferrerPolicy enum and the
2516         FetchOptions::ReferrerPolicy one.
2517
2518         Tests: http/tests/referrer-policy/origin-when-cross-origin/cross-origin-http-http.html
2519                http/tests/referrer-policy/origin-when-cross-origin/cross-origin-http.https.html
2520                http/tests/referrer-policy/origin-when-cross-origin/same-origin.html
2521                http/tests/referrer-policy/same-origin/cross-origin-http-http.html
2522                http/tests/referrer-policy/same-origin/cross-origin-http.https.html
2523                http/tests/referrer-policy/same-origin/same-origin.html
2524                http/tests/referrer-policy/strict-origin-when-cross-origin/cross-origin-http-http.html
2525                http/tests/referrer-policy/strict-origin-when-cross-origin/cross-origin-http.https.html
2526                http/tests/referrer-policy/strict-origin-when-cross-origin/same-origin.html
2527                http/tests/referrer-policy/strict-origin/cross-origin-http-http.html
2528                http/tests/referrer-policy/strict-origin/cross-origin-http.https.html
2529                http/tests/referrer-policy/strict-origin/same-origin.html
2530
2531         * Modules/fetch/FetchLoader.cpp:
2532         (WebCore::FetchLoader::start):
2533         * Modules/fetch/FetchReferrerPolicy.h:
2534         * Modules/fetch/FetchReferrerPolicy.idl:
2535         * Modules/fetch/FetchRequest.h:
2536         * Modules/fetch/FetchRequestInit.h:
2537         * dom/Document.cpp:
2538         (WebCore::Document::processReferrerPolicy):
2539         (WebCore::Document::applyQuickLookSandbox):
2540         (WebCore::Document::applyContentDispositionAttachmentSandbox):
2541         * dom/Document.h:
2542         * loader/FetchOptions.h:
2543         * loader/FrameNetworkingContext.h:
2544         * loader/PingLoader.cpp:
2545         (WebCore::PingLoader::sendBeacon):
2546         Drop explicit call to SecurityPolicy::shouldHideReferrer(). This is already called inside
2547         SecurityPolicy::generateReferrerHeader() and used only when needed, depending on the
2548         actual referrer policy.
2549
2550         * loader/cache/CachedResourceLoader.cpp:
2551         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
2552         * loader/cache/CachedResourceRequest.cpp:
2553         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
2554         * page/SecurityPolicy.cpp:
2555         (WebCore::referrerToOriginString):
2556         (WebCore::SecurityPolicy::generateReferrerHeader):
2557         * page/SecurityPolicy.h:
2558         * platform/ReferrerPolicy.h:
2559
2560 2017-08-03  Daniel Bates  <dabates@apple.com>
2561
2562         Support ::marker pseudo-element
2563         https://bugs.webkit.org/show_bug.cgi?id=141477
2564
2565         Reviewed by David Hyatt.
2566
2567         Implements the ::marker pseudo element as per the CSS Pseudo-Element Module Level 4
2568         spec., <https://drafts.csswg.org/css-pseudo-4> (Editor's Draft, 24 July 2017).
2569
2570         The ::marker pseudo element is a convenience pseudo element that allows a person to
2571         style the appearance of a list item marker. For example, to render all list item
2572         markers in bolded, blue text you would define a stylesheet with the following content:
2573
2574         li::marker {
2575             color: blue;
2576             font-weight: bold;
2577         }
2578
2579         and this could be applied to a page that contains markup of the form:
2580
2581         <ol>
2582             <li>Item 1</li>
2583             <li>Item 2</li>
2584             ...
2585             <li>Item N-1</li>
2586             <li>Item N</li>
2587         </ol>
2588
2589         Formerly to the achieve the same effect you would need to use a stylesheet of the form:
2590
2591         li {
2592             color: blue;
2593             font-weight: bold;
2594         }
2595
2596         .list-item-content {
2597             all: initial;
2598         }
2599
2600         and then write your markup to have the form:
2601
2602         <ol>
2603             <li><span class="list-item-content">Item 1</span></li>
2604             <li><span class="list-item-content">Item 2</span></li>
2605             ...
2606             <li><span class="list-item-content">Item N-1</span></li>
2607             <li><span class="list-item-content">Item N</span></li>
2608         </ol>
2609
2610         The ::marker pseudo element only supports stylizing all font properties and the color property
2611         of a list item marker.
2612
2613         Tests: fast/lists/list-marker-with-display.html
2614                http/wpt/css/css-pseudo-4/marker-and-other-pseudo-elements.html
2615                http/wpt/css/css-pseudo-4/marker-color.html
2616                http/wpt/css/css-pseudo-4/marker-font-properties.html
2617                http/wpt/css/css-pseudo-4/marker-inherit-values.html
2618
2619         * css/CSSSelector.cpp:
2620         (WebCore::CSSSelector::pseudoId): Return the pseudo id for the ::marker pseudo element.
2621         * css/CSSSelector.h: Add enumerator PseudoElementMarker to the pseudo element enum.
2622         * css/RuleSet.cpp:
2623         (WebCore::determinePropertyWhitelistType): Return whitelist type PropertyWhitelistMarker for ::marker
2624         so that we match rules against the acceptable rules for ::marker.
2625         * css/RuleSet.h: Add enumerator PropertyWhitelistMarker to the property whitelist type enum.
2626         * css/SelectorPseudoElementTypeMap.in: Add "marker" to the list of pseudo element types.
2627         * css/StyleResolver.cpp:
2628         (WebCore::isValidMarkerStyleProperty): Determines if the specified CSS property is valid inside ::marker.
2629         (WebCore::StyleResolver::CascadedProperties::addMatch): Only recognize CSS properties in the content block
2630         of ::marker that match the ::marker whitelist policy.
2631         * rendering/RenderListItem.cpp:
2632         (WebCore::RenderListItem::computeMarkerStyle): Computes the style object for the list item marker. We
2633         apply the user-agent style to the marker here as opposed to defining ::marker in the UA sheet as per
2634         the spec. as an optimization to avoid having the style resolver apply the pseudo element to all elements.
2635         For now, we always inherit style from the originating element (list item). Added FIXME to selectively
2636         inherit styles.
2637         (WebCore::RenderListItem::styleDidChange): Always apply the list marker style to the list marker renderer.
2638         * rendering/RenderListItem.h:
2639         * rendering/style/RenderStyleConstants.h: Add pseudo ID for the ::marker pseudo element.
2640
2641 2017-08-03  Antti Koivisto  <antti@apple.com>
2642
2643         Factor common code in Style::*ChangeInvalidation into helper functions
2644         https://bugs.webkit.org/show_bug.cgi?id=174312
2645
2646         Reviewed by Andreas Kling.
2647
2648         There is a lot of copy code here.
2649
2650         * Style/StyleInvalidationFunctions.h: Added.
2651         (WebCore::Style::traverseRuleFeaturesInShadowTree):
2652         (WebCore::Style::traverseRuleFeaturesForSlotted):
2653         (WebCore::Style::traverseRuleFeatures):
2654
2655             Add functions for traversing rule features that may affect style of an element.
2656             Use lambdas to implement client-specific behavior.
2657
2658         * WebCore.xcodeproj/project.pbxproj:
2659         * style/AttributeChangeInvalidation.cpp:
2660         (WebCore::Style::mayBeAffectedByAttributeChange):
2661         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
2662         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2663         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2664         * style/ClassChangeInvalidation.cpp:
2665         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
2666         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2667         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2668         * style/IdChangeInvalidation.cpp:
2669         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
2670         (WebCore::Style::mayBeAffectedByHostRules): Deleted.
2671         (WebCore::Style::mayBeAffectedBySlottedRules): Deleted.
2672
2673 2017-08-03  Zan Dobersek  <zdobersek@igalia.com>
2674
2675         [EME] CDM constructor assigns CDMPrivate member multiple times
2676         https://bugs.webkit.org/show_bug.cgi?id=175128
2677
2678         Reviewed by Xabier Rodriguez-Calvar.
2679
2680         In the CDM class constructor, iterate over the registered CDM
2681         factories, finding one that supports the specified key system.
2682         A CDMPrivate object is created through that factory, and the
2683         iteration is now stopped at that point, while previously it
2684         contined to potentially create CDMPrivate objects through
2685         other factories.
2686
2687         Helper createCDMPrivateForKeySystem() function is removed.
2688
2689         * Modules/encryptedmedia/CDM.cpp:
2690         (WebCore::CDM::CDM):
2691         (WebCore::createCDMPrivateForKeySystem): Deleted.
2692
2693 2017-08-03  Emilio Cobos Ãlvarez  <ecobos@igalia.com>
2694
2695         Don't always recalc the style of display: contents elements.
2696         https://bugs.webkit.org/show_bug.cgi?id=172753
2697
2698         Reviewed by Antti Koivisto.
2699
2700         No new tests (no functionality change). This only removes an
2701         inefficiency.
2702
2703         * dom/Element.cpp:
2704         (WebCore::Element::existingComputedStyle):
2705         * dom/Element.h:
2706         * style/RenderTreeUpdater.cpp:
2707         (WebCore::RenderTreeUpdater::updateRenderTree):
2708         (WebCore::RenderTreeUpdater::updateElementRenderer):
2709         * style/StyleTreeResolver.cpp:
2710         (WebCore::Style::renderOrDisplayContentsStyle):
2711         (WebCore::Style::TreeResolver::resolveElement):
2712         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2713         (WebCore::Style::shouldResolveElement):
2714         (WebCore::Style::TreeResolver::resolveComposedTree):
2715
2716 2017-08-02  Devin Rousso  <drousso@apple.com>
2717
2718         Web Inspector: add stack trace information for each RecordingAction
2719         https://bugs.webkit.org/show_bug.cgi?id=174663
2720
2721         Reviewed by Joseph Pecoraro.
2722
2723         Tests: inspector/canvas/recording-2d.html
2724                inspector/model/recording.html
2725
2726         * inspector/InspectorCanvas.h:
2727         * inspector/InspectorCanvas.cpp:
2728         (WebCore::InspectorCanvas::indexForData):
2729         (WebCore::InspectorCanvas::buildAction):
2730
2731 2017-08-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2732
2733         Merge WTFThreadData to Thread::current
2734         https://bugs.webkit.org/show_bug.cgi?id=174716
2735
2736         Reviewed by Mark Lam.
2737
2738         Use Thread::current() instead.
2739
2740         * fileapi/AsyncFileStream.cpp:
2741         * platform/ThreadGlobalData.cpp:
2742         (WebCore::ThreadGlobalData::ThreadGlobalData):
2743         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
2744         * platform/ios/wak/WebCoreThread.mm:
2745         (StartWebThread):
2746         * workers/WorkerThread.cpp:
2747         (WebCore::WorkerThread::workerThread):
2748
2749 2017-08-02  Sam Weinig  <sam@webkit.org>
2750
2751         Fix crashes in GC creating a document fragment on a background thread
2752         https://bugs.webkit.org/show_bug.cgi?id=175111
2753
2754         Reviewed by Chris Dumez.
2755
2756         r220095 (https://webkit.org/b/175006) change JSHTMLTemplateElement from using a
2757         private name + property to manager the lifetime of the reference DocumentFragment
2758         to using the idiomatic visitAdditionalChildren. Unfortunately, the function to access
2759         the DocumentFragment lazily creates it. If this lazy creation happens on a GC thread,
2760         badness ensues. This introduces an accessor that returns the DocumentFragment if it
2761         has been created or null if it has not.
2762
2763         * bindings/js/JSHTMLTemplateElementCustom.cpp:
2764         (WebCore::JSHTMLTemplateElement::visitAdditionalChildren):
2765         * html/HTMLTemplateElement.cpp:
2766         (WebCore::HTMLTemplateElement::contentIfAvailable):
2767         * html/HTMLTemplateElement.h:
2768
2769 2017-08-02  Sam Weinig  <sam@webkit.org>
2770
2771         [WebIDL] Simplify [EnabledBySettings] extended attribute code to not require passing a global object to finishCreation
2772         https://bugs.webkit.org/show_bug.cgi?id=175087
2773
2774         Reviewed by Chris Dumez.
2775
2776         * bindings/scripts/CodeGeneratorJS.pm:
2777         (GenerateImplementation):
2778         (GeneratePrototypeDeclaration):
2779         Remove unnecessary passing of the global object to finishCreation for [EnabledBySettings].
2780
2781         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2782         * bindings/scripts/test/JS/JSTestNode.cpp:
2783         * bindings/scripts/test/JS/JSTestObj.cpp:
2784         Update tests.
2785
2786 2017-08-02  Andy Estes  <aestes@apple.com>
2787
2788         REGRESSION (r207155): Unable to switch sheets when previewing Numbers '09 spreadsheets
2789         https://bugs.webkit.org/show_bug.cgi?id=175098
2790         <rdar://problem/31416763>
2791
2792         Reviewed by Daniel Bates.
2793
2794         r207155 enabled sandboxing on the frame displaying a QuickLook preview. This restricted
2795         frames within the sandbox from navigating their sandboxed siblings or ancestors, which
2796         breaks the functionality of multi-sheet Numbers '09 spreadsheet previews. These previews
2797         contain a frameset with a table of contents frame and a content frame, and the table of
2798         contents frame needs to be able to navigate the content frame when the sheet selection
2799         changes.
2800
2801         Fix this by disabling the SandboxNavigation flag in the QuickLook sandbox. Frames within the
2802         sandbox will be able to navigate each other, but will not be able to navigate the top frame
2803         (due to SandboxTopNavigation still being enabled), nor will they be able to navigate any
2804         other ancestor frame outside the sandbox (due to QuickLook previews being in a different
2805         origin than the hosting frame). These two cases are covered by existing tests.
2806
2807         Test: quicklook/multi-sheet-numbers-09.html
2808
2809         * dom/Document.cpp:
2810         (WebCore::Document::applyQuickLookSandbox): Added a call to
2811         disableSandboxFlags(SandboxNavigation) after applying the content security policy.
2812         * dom/SecurityContext.h:
2813         (WebCore::SecurityContext::disableSandboxFlags): Defined disableSandboxFlags().
2814
2815 2017-08-02  Jer Noble  <jer.noble@apple.com>
2816
2817         [MSE] Removing samples when presentation order does not match decode order can cause bad behavior.
2818         https://bugs.webkit.org/show_bug.cgi?id=175091
2819
2820         Reviewed by Eric Carlson.
2821
2822         Address follow-up comments to r219519.
2823
2824         * Modules/mediasource/SourceBuffer.cpp:
2825         (WebCore::SourceBuffer::removeCodedFrames):
2826
2827 2017-08-02  Jeremy Jones  <jeremyj@apple.com>
2828
2829         Remove unused and obsolete setting mediaDocumentEntersFullscreenAutomatically
2830         https://bugs.webkit.org/show_bug.cgi?id=175080
2831
2832         Reviewed by Jon Lee.
2833
2834         No new tests because this only removes unused code.
2835
2836         This is obsolete because of the alternate solution in
2837         https://bugs.webkit.org/show_bug.cgi?id=174850
2838
2839         * page/Settings.in:
2840
2841 2017-08-02  Filip Pizlo  <fpizlo@apple.com>
2842
2843         GPUBuffer::length() should return the size of the array buffer backing the GPU buffer, not the rounded-up GPU buffer length
2844         https://bugs.webkit.org/show_bug.cgi?id=175079
2845
2846         Reviewed by Simon Fraser.
2847
2848         This fixes a failure in the GPU.BufferCreate unit test.
2849         
2850         The problem is that in order to have a Metal buffer wrap memory we allocated, we have to tell Metal
2851         that the memory is page-aligned. This means that the Metal buffer reports back a page-aligned size,
2852         which is different than what the test expected.
2853         
2854         It seems that it's most convenient for our GPUBuffer class to return the unaligned length, rather
2855         than the aligned length. This is just a simple matter of returning the length from the ArrayBuffer
2856         rather than the Metal buffer.
2857         
2858         This fixes the unit test and is probably more sensible for actual users of this class, since the page
2859         alignment of the length is a goofy implementation detail.
2860
2861         * platform/graphics/cocoa/GPUBufferMetal.mm:
2862         (WebCore::GPUBuffer::length const):
2863
2864 2017-08-01  Brian Burg  <bburg@apple.com>
2865
2866         HTML file input elements do not support file extensions in the "accept" attribute
2867         https://bugs.webkit.org/show_bug.cgi?id=95698
2868         <rdar://problem/12231850>
2869
2870         Reviewed by Darin Adler.
2871
2872         Serialize the accepted file extensions so they can be accessed in the UI process.
2873
2874         * platform/FileChooser.h:
2875         * platform/FileChooser.cpp:
2876         (WebCore::FileChooser::invalidate): Modernize.
2877         (WebCore::FileChooserSettings::acceptTypes const): Deleted.
2878         This is dead code, it was only used by Chromium.
2879
2880 2017-08-02  Fujii Hironori  <Hironori.Fujii@sony.com>
2881
2882         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
2883         https://bugs.webkit.org/show_bug.cgi?id=175010
2884         <rdar://problem/33647818>
2885
2886         Reviewed by Alex Christensen.
2887
2888         No new tests because no behavior change.
2889
2890         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
2891
2892         * contentextensions/ContentExtensionParser.cpp:
2893         (WebCore::ContentExtensions::isValidCSSSelector):
2894         Call QualifiedName::init().
2895         * dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
2896         * dom/QualifiedName.cpp:
2897         (WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
2898         instead of placement new.
2899         * dom/QualifiedName.h: Use LazyNeverDestroyed.
2900
2901 2017-08-01  Joseph Pecoraro  <pecoraro@apple.com>
2902
2903         CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations
2904         https://bugs.webkit.org/show_bug.cgi?id=175064
2905
2906         Reviewed by Tim Horton.
2907
2908         * platform/ios/PlatformPasteboardIOS.mm:
2909         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2910         Adopt a created string into the RetainPtr.
2911
2912         * platform/ios/WebItemProviderPasteboard.h:
2913         * platform/ios/WebItemProviderPasteboard.mm:
2914         (-[WebItemProviderRegistrationInfoList dealloc]):
2915         Release suggestedName and switch from -strong to -copy.
2916
2917 2017-08-01  Chris Dumez  <cdumez@apple.com>
2918
2919         Unreviewed, update Beacon API status to "In Development".
2920
2921         * features.json:
2922
2923 2017-08-01  Chris Dumez  <cdumez@apple.com>
2924
2925         Add initial support for navigator.sendBeacon
2926         https://bugs.webkit.org/show_bug.cgi?id=175007
2927         <rdar://problem/33547728>
2928
2929         Reviewed by Sam Weinig.
2930
2931         Add initial support for navigator.sendBeacon behind an experimental
2932         feature runtime flag. The specification is available at:
2933         - https://w3c.github.io/beacon/
2934
2935         The current implementation supports sending beacons with all types of
2936         payloads except for ReadableStream. Some functionality is incomplete
2937         and will be taken care of in follow-up patches:
2938         - Support for CORS preflight for the cases where it is required. We currently
2939           return false and do not send the beacon in such cases.
2940         - Better support for redirects.
2941         - Use a more power-friendly network priority for beacon requests.
2942
2943         Tests: http/tests/blink/sendbeacon/*
2944                http/tests/security/mixedContent/beacon/insecure-beacon-in-iframe.html
2945                http/wpt/beacon/*
2946                imported/blink/fast/beacon/*
2947                imported/w3c/web-platform-tests/beacon/*
2948
2949         * CMakeLists.txt:
2950         * DerivedSources.make:
2951         * Modules/beacon/NavigatorBeacon.cpp: Added.
2952         (WebCore::NavigatorBeacon::sendBeacon):
2953         * Modules/beacon/NavigatorBeacon.h: Added.
2954         * Modules/beacon/NavigatorBeacon.idl: Added.
2955         * WebCore.xcodeproj/project.pbxproj:
2956         * loader/PingLoader.cpp:
2957         (WebCore::PingLoader::sendBeacon):
2958         * loader/PingLoader.h:
2959
2960 2017-08-01  Filip Pizlo  <fpizlo@apple.com>
2961
2962         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)
2963         https://bugs.webkit.org/show_bug.cgi?id=174727
2964
2965         Reviewed by Mark Lam.
2966
2967         No new tests because no change in behavior.
2968         
2969         Needed to teach Metal how to allocate in the Gigacage.
2970
2971         * platform/graphics/cocoa/GPUBufferMetal.mm:
2972         (WebCore::GPUBuffer::GPUBuffer):
2973         (WebCore::GPUBuffer::contents):
2974
2975 2017-08-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2976
2977         [WinCairo] Implement Font::platformBoundsForGlyph
2978         https://bugs.webkit.org/show_bug.cgi?id=174813
2979
2980         Reviewed by Alex Christensen.
2981
2982         Test: fast/text/emphasis.html
2983
2984         * platform/graphics/win/SimpleFontDataCairoWin.cpp:
2985         (WebCore::Font::platformBoundsForGlyph): Implemented by copying
2986         the code from Font::boundsForGDIGlyph().
2987
2988 2017-08-01  Zalan Bujtas  <zalan@apple.com>
2989
2990         REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
2991         https://bugs.webkit.org/show_bug.cgi?id=175009
2992         <rdar://problem/33505791>
2993
2994         Reviewed by Simon Fraser.
2995
2996         This patch ensures that we report the desktop, non-frame-flattened frame size for media queries in subframes.
2997         Some websites don't expect the iframes to be expanded to the size of the content and when the media query
2998         callback mutates the content (triggering frame resize), they might end up getting into a never ending layout.
2999
3000         Test: fast/frames/flattening/media-query-growing-content.html
3001
3002         * css/MediaQueryEvaluator.cpp:
3003         (WebCore::orientationEvaluate):
3004         (WebCore::aspectRatioEvaluate):
3005         (WebCore::heightEvaluate):
3006         (WebCore::widthEvaluate):
3007         * page/FrameView.cpp:
3008         (WebCore::FrameView::layout):
3009         (WebCore::FrameView::layoutSizeForMediaQuery const):
3010         (WebCore::FrameView::evaluateMediaQueryList):
3011         * page/FrameView.h:
3012
3013 2017-07-26  Jiewen Tan  <jiewen_tan@apple.com>
3014
3015         Add tests to detect mistakes in backward compatibility when the structured clone algorithm is changed in the future
3016         https://bugs.webkit.org/show_bug.cgi?id=173998
3017
3018         Reviewed by Darin Adler.
3019
3020         * bindings/js/SerializedScriptValue.cpp:
3021         Add a comment.
3022
3023 2017-08-01  Matt Lewis  <jlewis3@apple.com>
3024
3025         Unreviewed, rolling out r220089.
3026
3027         This caused multiple crashes on macOS Debug testers.
3028
3029         Reverted changeset:
3030
3031         "Use LazyNeverDestroyed instead of DEFINE_GLOBAL for
3032         QualifiedName"
3033         https://bugs.webkit.org/show_bug.cgi?id=175010
3034         http://trac.webkit.org/changeset/220089
3035
3036 2017-08-01  Sam Weinig  <sam@webkit.org>
3037
3038         [WebIDL] Swap a custom attribute for a custom mark function for HTMLTemplateElement
3039         https://bugs.webkit.org/show_bug.cgi?id=175006
3040
3041         Reviewed by Chris Dumez.
3042
3043         Use the standard way of augmenting GC, visitAdditionalChildren, rather
3044         than using a private name to create ownership.
3045
3046         * bindings/js/JSHTMLTemplateElementCustom.cpp:
3047         (WebCore::JSHTMLTemplateElement::visitAdditionalChildren):
3048         (WebCore::JSHTMLTemplateElement::content const): Deleted.
3049         * html/HTMLTemplateElement.idl:
3050
3051 2017-08-01  Zan Dobersek  <zdobersek@igalia.com>
3052
3053         [GCrypt] Gather crypto constants in a single location
3054         https://bugs.webkit.org/show_bug.cgi?id=174091
3055
3056         Reviewed by Jiewen Tan.
3057
3058         Gather common constants used across the libgcrypt-specific Web Crypto
3059         implementations in a single place -- in the GCryptUtilities.h header,
3060         inside the CryptoConstants namespace. The various ASN.1 object identifiers
3061         and other helper values are placed inside, in the std::array<uint8_t, N>
3062         container.
3063
3064         Additionally, CryptoConstants::matches() helper function is provided. It
3065         compares the provided data-and-size pair with the given std::array
3066         container and returns true if the std::memcmp() call returns 0.
3067
3068         Changes in CryptoKeyEC and CryptoKeyRSA consist mostly of switching to the
3069         use of CryptoConstants::matches() and the CryptoConstants data arrays, as
3070         well as some whitespace cleanup.
3071
3072         Additionallity in CryptoKeyEC, the helper functions covering various curve
3073         attributes are reordered, renamed and reorganized for simplicity.
3074
3075         No new tests -- no changes in behavior.
3076
3077         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
3078         (WebCore::curveIdentifier):
3079         (WebCore::curveSize):
3080         (WebCore::curveUncompressedFieldElementSize):
3081         (WebCore::curveUncompressedPointSize):
3082         (WebCore::CryptoKeyEC::platformImportRaw):
3083         (WebCore::CryptoKeyEC::platformImportJWKPublic):
3084         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
3085         (WebCore::supportedAlgorithmIdentifier):
3086         (WebCore::curveForIdentifier):
3087         (WebCore::CryptoKeyEC::platformImportSpki):
3088         (WebCore::CryptoKeyEC::platformExportRaw):
3089         (WebCore::CryptoKeyEC::platformAddFieldElements):
3090         (WebCore::CryptoKeyEC::platformExportSpki):
3091         (WebCore::CryptoKeyEC::platformExportPkcs8):
3092         (WebCore::uncompressedPointSizeForCurve): Deleted.
3093         (WebCore::uncompressedFieldElementSizeForCurve): Deleted.
3094         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3095         (WebCore::supportedAlgorithmIdentifier):
3096         (WebCore::CryptoKeyRSA::importPkcs8):
3097         (WebCore::CryptoKeyRSA::exportSpki):
3098         (WebCore::CryptoKeyRSA::exportPkcs8):
3099         * crypto/gcrypt/GCryptUtilities.h:
3100         (WebCore::CryptoConstants::matches):
3101
3102 2017-07-31  Fujii Hironori  <Hironori.Fujii@sony.com>
3103
3104         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for MediaFeatureNames
3105         https://bugs.webkit.org/show_bug.cgi?id=175008
3106
3107         Reviewed by Alex Christensen.
3108
3109         No new tests because no behavior change.
3110
3111         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3112
3113         * css/MediaFeatureNames.cpp:
3114         (WebCore::MediaFeatureNames::init): Do not include
3115         <wtf/StaticConstructors.h>. Use LazyNeverDestroyed instead of
3116         DEFINE_GLOBAL. Call LazyNeverDestroyed::construct instead of
3117         placement new.
3118         * css/MediaFeatureNames.h: Use LazyNeverDestroyed.
3119         * css/MediaQueryEvaluator.cpp:
3120         (WebCore::MediaQueryEvaluator::evaluate const): Dereference with ->.
3121
3122 2017-07-31  Fujii Hironori  <Hironori.Fujii@sony.com>
3123
3124         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
3125         https://bugs.webkit.org/show_bug.cgi?id=175010
3126
3127         Reviewed by Alex Christensen.
3128
3129         No new tests because no behavior change.
3130
3131         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
3132
3133         * dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
3134         * dom/QualifiedName.cpp:
3135         (WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
3136         instead of placement new.
3137         * dom/QualifiedName.h: Use LazyNeverDestroyed.
3138
3139 2017-07-31  Matt Rajca  <mrajca@apple.com>
3140
3141         Support quirk for letting media autoplay if the user interacted with at least one media element.
3142         https://bugs.webkit.org/show_bug.cgi?id=175005
3143         <rdar://problem/33476038>
3144
3145         Reviewed by Eric Carlson.
3146
3147         If the user has interacted with at least one media element, let other media elements auto-play
3148         as a quirk.
3149
3150         * dom/Document.cpp:
3151         (WebCore::Document::updateIsPlayingMedia):
3152         * dom/Document.h:
3153         (WebCore::Document::noteUserInteractionWithMediaElement):
3154         * html/HTMLMediaElement.cpp:
3155         (WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture):
3156         * html/MediaElementSession.cpp:
3157         (WebCore::needsDocumentLevelMediaUserGestureQuirk):
3158         (WebCore::MediaElementSession::playbackPermitted const):
3159         * page/MediaProducer.h:
3160
3161 2017-07-31  Nan Wang  <n_wang@apple.com>
3162
3163         AX: CFEqual is failing on text markers with exact same data
3164         https://bugs.webkit.org/show_bug.cgi?id=175002
3165         <rdar://problem/33636985>
3166
3167         Reviewed by Chris Fleizach.
3168
3169         We should zero the memory of the TextMarkerData instance so that it
3170         can be tested for byte-equivalence.
3171
3172         Made sure this change won't break any of the existing tests.
3173
3174         * accessibility/AXObjectCache.cpp:
3175         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
3176         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
3177
3178 2017-07-28  Matt Rajca  <mrajca@apple.com>
3179
3180         Propagate user gesture tokens when script elements are loaded.
3181         https://bugs.webkit.org/show_bug.cgi?id=174959
3182
3183         Reviewed by Eric Carlson.
3184
3185         Propagate user gesture tokens when script elements are loaded (i.e. between the time an
3186         element is created and its onload handler is invoked).
3187
3188         * dom/ScriptElement.cpp:
3189         (WebCore::ScriptElement::ScriptElement):
3190         (WebCore::ScriptElement::dispatchLoadEventRespectingUserGestureIndicator):
3191         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
3192         (WebCore::ScriptElement::executePendingScript):
3193         * dom/ScriptElement.h:
3194
3195 2017-07-31  Matt Lewis  <jlewis3@apple.com>
3196
3197         Unreviewed, rolling out r220048.
3198
3199         This revision caused multiple crashes in fast/images. See
3200         webkit.org/b/174990
3201
3202         Reverted changeset:
3203
3204         "RenderImageResourceStyleImage::image() should return the
3205         nullImage() if the image is not available"
3206         https://bugs.webkit.org/show_bug.cgi?id=174874
3207         http://trac.webkit.org/changeset/220048
3208
3209 2017-07-31  Sam Weinig  <sam@webkit.org>
3210
3211         Remove unnecessary exceptions from storage code
3212         https://bugs.webkit.org/show_bug.cgi?id=174572
3213
3214         Reviewed by Chris Dumez.
3215
3216         Remove checks for canAccessStorage() and the exceptions they would cause.
3217         These were used for Storage in ephemeral sessions, but they are now supported.
3218         Add checks for a null frame to functions that can mutate the storage, as the
3219         frame is needed for that, and it retains our existing behavior for disconnected
3220         frames. By removing these checks / exceptions, we can fully generate Storage.idl.
3221
3222         * CMakeLists.txt:
3223         * WebCore.xcodeproj/project.pbxproj:
3224         * bindings/js/JSBindingsAllInOne.cpp:
3225         * bindings/js/JSStorageCustom.cpp: Removed.
3226         Remove JSStorageCustom.cpp
3227
3228         * loader/EmptyClients.cpp:
3229         * page/DOMWindow.cpp:
3230         (WebCore::DOMWindow::sessionStorage):
3231         (WebCore::DOMWindow::localStorage):
3232         * storage/StorageArea.h:
3233         Remove canAccessStorage.
3234
3235         * storage/Storage.cpp:
3236         (WebCore::Storage::length):
3237         (WebCore::Storage::key):
3238         (WebCore::Storage::getItem):
3239         (WebCore::Storage::setItem):
3240         (WebCore::Storage::removeItem):
3241         (WebCore::Storage::clear):
3242         (WebCore::Storage::contains):
3243         (WebCore::Storage::isSupportedPropertyName):
3244         (WebCore::Storage::supportedPropertyNames):
3245         * storage/Storage.h:
3246         * storage/Storage.idl:
3247         Remove canAccessStorage checks and corresponding exceptions. Add supportedPropertyNames
3248         to allow the removal of the [CustomGetOwnPropertyNames].
3249
3250 2017-07-31  Matt Lewis  <jlewis3@apple.com>
3251
3252         Unreviewed, rolling out r220060.
3253
3254         This broke our internal builds. Contact reviewer of patch for
3255         more information.
3256
3257         Reverted changeset:
3258
3259         "Merge WTFThreadData to Thread::current"
3260         https://bugs.webkit.org/show_bug.cgi?id=174716
3261         http://trac.webkit.org/changeset/220060
3262
3263 2017-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
3264
3265         Merge WTFThreadData to Thread::current
3266         https://bugs.webkit.org/show_bug.cgi?id=174716
3267
3268         Reviewed by Sam Weinig.
3269
3270         Use Thread::current() instead.
3271
3272         * fileapi/AsyncFileStream.cpp:
3273         * platform/ThreadGlobalData.cpp:
3274         (WebCore::ThreadGlobalData::ThreadGlobalData):
3275         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
3276         * platform/ios/wak/WebCoreThread.mm:
3277         (StartWebThread):
3278         * workers/WorkerThread.cpp:
3279         (WebCore::WorkerThread::workerThread):
3280
3281 2017-07-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3282
3283         Created a bool pretty printer at WTF for debugging purposes
3284         https://bugs.webkit.org/show_bug.cgi?id=174893
3285
3286         Reviewed by Darin Adler.
3287
3288         Use WTF::boolPrettyPrinter in debugging messages.
3289
3290         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3291         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
3292         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3293         (WebCore::MediaPlayerPrivateGStreamerMSE::seek):
3294
3295 2017-07-30  Zan Dobersek  <zdobersek@igalia.com>
3296
3297         Unreviewed. Suppress the -Wextra compiler warning when building with GCC 6.3.0,
3298         explicitly initializing the RefCounted<> base class in the
3299         FetchHeaders(const FetchHeaders&) constructor.
3300
3301         Note that while that's the signature of the copy constructor for the FetchHeaders
3302         class, the base RefCounted<> class is not copyable, so the default RefCounted<>
3303         constructor is used, but the FetchHeaders resources are normally copied into the
3304         new object from the one that's passed in.
3305
3306         * Modules/fetch/FetchHeaders.h:
3307         (WebCore::FetchHeaders::FetchHeaders):
3308
3309 2017-07-30  Darin Adler  <darin@apple.com>
3310
3311         Remove code in HTMLObjectElement attribute parsing that forces style resolution and layout
3312         https://bugs.webkit.org/show_bug.cgi?id=130653
3313
3314         Reviewed by Antti Koivisto.
3315
3316         Also fixes a bug where load events are delivered prematurely in some cases
3317         when an object, embed, frame, or iframe element is still loading.
3318
3319         * dom/Document.cpp:
3320         (WebCore::Document::loadEventDelayTimerFired): Added a call to
3321         FrameLoader::checkLoadComplete. Goes along with the change to
3322         FrameLoader::checkLoadCompleteForThisFrame, which now respects the
3323         isDelayingLoadEvent flag.
3324
3325         * html/HTMLAppletElement.cpp:
3326         (WebCore::HTMLAppletElement::HTMLAppletElement): Removed the createdByParser argument,
3327         no longer needed by the base class.
3328         (WebCore::HTMLAppletElement::create): Added call to finishCreating, which is now part of
3329         the process of creating any object in a class derived from HTMLPlugInImageElement.
3330         (WebCore::HTMLAppletElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate
3331         is only called when it's becoming false; avoids a false/true/false round trip that can
3332         cause trouble.
3333         * html/HTMLAppletElement.h: Updated for the above.
3334
3335         * html/HTMLEmbedElement.cpp:
3336         (WebCore::HTMLEmbedElement::HTMLEmbedElement): Removed the createdByParser argument,
3337         no longer needed by the base class.
3338         (WebCore::HTMLEmbedElement::create): Added call to finishCreating, which is now part of
3339         the process of creating any object in a class derived from HTMLPlugInImageElement.
3340         (WebCore::HTMLEmbedElement::parseAttribute): Changed srcAttr to call
3341         updateImageLoaderWithNewURLSoon to do the image loading logic.
3342         (WebCore::HTMLEmbedElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate
3343         is only called when it's becoming false; avoids a false/true/false round trip that can
3344         cause trouble.
3345         * html/HTMLEmbedElement.h: Updated for the above.
3346
3347         * html/HTMLMediaElement.cpp:
3348         (WebCore::HTMLMediaElement::setReadyState): Call setShouldDelayLoadEvent(false) when
3349         transitioning to HAVE_CURRENT_DATA (or beyond), even if we have already fired a loadeddata
3350         event in the past. This matches what the HTML specification calls for, but only if you
3351         read it carefully. Without this change, and with the more complete implementation of
3352         load event delay below, one of the regression tests hangs because are permanently stuck
3353         dealying load events. Also added a FIXME about other code that likely has a similar
3354         problem; the symptom is likely to be subtle and minor, though.
3355
3356         * html/HTMLObjectElement.cpp:
3357         (WebCore::HTMLObjectElement::HTMLObjectElement): Removed the createdByParser argument,
3358         no longer needed by the base class.
3359         (WebCore::HTMLObjectElement::create): Added call to finishCreating, which is now part of
3360         the process of creating any object in a class derived from HTMLPlugInImageElement.
3361         (WebCore::HTMLObjectElement::parseAttribute): Changed dataAttr to use
3362         updateImageLoaderWithNewURLSoon. Explicitly call scheduleUpdateForAfterStyleResolution
3363         since just calling invalidateStyleAndRenderersForSubtree alone is no longer sufficient.
3364         (WebCore::HTMLObjectElement::updateWidget): Rearranged logic so setNeedsWidgetUpdate
3365         is only called when it's becoming false; avoids a false/true/false round trip that can
3366         cause trouble.
3367         (WebCore::HTMLObjectElement::childrenChanged): Added calls to the new
3368         scheduleUpdateForAfterStyleResolution since invalidating style is no longer sufficient.
3369         (WebCore::HTMLObjectElement::renderFallbackContent): Remove the call to
3370         updateStyleIfNeeded. This is the main change that the title of this bug refers to.
3371         * html/HTMLObjectElement.h: Updated for the above. Also removed the
3372         clearUseFallbackContent function because it's clearer to set the data member in
3373         line at the single call site in HTMLObjectElement::parseAttribute.
3374
3375         * html/HTMLPlugInImageElement.cpp:
3376         (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): Removed the createdByParser
3377         argument; no need to set an m_needsWidgetUpdate flag differently for parser cases now.
3378         (WebCore::HTMLPlugInImageElement::finshCreating): Added. To be called after creating
3379         an element to do work that can't be done in a constructor.
3380         (WebCore::HTMLPlugInImageElement::didRecalcStyle): Added. Calls the new
3381         scheduleUpdateForAfterStyleResolution function.
3382         (WebCore::HTMLPlugInImageElement::didAttachRenderers): Moved all the logic from this
3383         function into scheduleUpdateForAfterStyleResolution. Also added a call through to the base
3384         class; cleans things up, even though it's just an assertion.
3385         (WebCore::HTMLPlugInImageElement::willDetachRenderers): Removed the call to
3386         setNeedsWidgetUpdate(true) here; no longer needed because the new logic already
3387         does the right thing in this case.
3388         (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary): Deleted. Now handled by
3389         updateAfterStyleResolution instead.
3390         (WebCore::HTMLPlugInImageElement::finishParsingChildren): Deleted. Handling updates
3391         after parsing all the children now comes naturally out of the new implementation.
3392         (WebCore::HTMLPlugInImageElement::scheduleUpdateForAfterStyleResolution): Added.
3393         Schedules a call to updateAfterStyleResolution when needed, and equally importantly,
3394         increments the load event delay count to make sure that loads that are part of that
3395         update can participate in decision about whether it's time for the load event.
3396         (WebCore::HTMLPlugInImageElement::updateAfterStyleResolution): Added.
3397         Combines updateWidgetIfNecessary and startLoadingImage, and also deals with the new
3398         m_needsImageReload boolean in cases where no actual loading is done.
3399         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument): Update load event delay
3400         count when moving an element that is in the middle of loading. This lets the
3401         updateAfterStyleResolution function do the right thing even when the element is
3402         moved without leaving anything stuck in a strange state.
3403         (WebCore::HTMLPlugInImageElement::prepareForDocumentSuspension): Call the new
3404         scheduleUpdateForAfterStyleResolution since invalidating style is no longer sufficient.
3405         (WebCore::HTMLPlugInImageElement::startLoadingImage): Deleted. Now handled by
3406         updateAfterStyleResolution instead.
3407         (WebCore::HTMLPlugInImageElement::updateImageLoaderWithNewURLSoon): Added. Does all
3408         the right things for when an image URL is changed; for use by the concrete derived classes.
3409         * html/HTMLPlugInImageElement.h: Updated for above changes. Also made m_imageLoader
3410         private rather than protected, and added the two new boolean data members.
3411
3412         * html/HTMLTagNames.in: Removed unneeded constructorNeedsCreatedByParser flags for
3413         applet, embed, and object.
3414
3415         * loader/DocumentLoader.cpp:
3416         (WebCore::DocumentLoader::isLoadingInAPISense): Return true if the document is
3417         delaying a load event.
3418
3419         * loader/FrameLoader.cpp:
3420         (WebCore::FrameLoader::checkLoadCompleteForThisFrame): Don't do any work if
3421         isDelayingLoadEvent is true; otherwise this function can have a side effect of
3422         triggering the load event.
3423         (WebCore::FrameLoader::detachFromParent): Schedule a checkLoadComplete here, too, not
3424         just a checkCompleted. This is relevant if the frame we are detaching was delaying
3425         a load event because it no longer will be and so the load might be complete.
3426
3427 2017-07-30  Sam Weinig  <sam@webkit.org>
3428
3429         [WebIDL] Remove JS builtin bindings for FetchRequest, DOMWindowFetch and WorkerGlobalScopeFetch
3430         https://bugs.webkit.org/show_bug.cgi?id=174974
3431
3432         Reviewed by Darin Adler.