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