Introduce Storage Access API (document parts) as an experimental feature
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-09-13  John Wilander  <wilander@apple.com>
2
3         Introduce Storage Access API (document parts) as an experimental feature
4         https://bugs.webkit.org/show_bug.cgi?id=175759
5         <rdar://problem/34414107>
6
7         Reviewed by Alex Christensen.
8
9         Storage Access API is an experimental feature which allows cross-origin,
10         sandboxed iframes to request access to their first-party storage (as
11         opposed to partitioned storage). This might be restricted to cookies or
12         might cover all stateful mechanisms.
13
14         It introduces the following three developer-facing things:
15         - A new readonly attribute, document.hasStorageAccess.
16         - A new function, document.requestStorageAccess().
17         - A new iframe sandbox token, allow-storage-access-by-user-activation.
18
19         Tests: http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html
20                http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
21                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-iframe.html
22                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
23                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
24                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
25                http/tests/storageAccess/request-storage-access-same-origin-iframe.html
26                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
27                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html
28                http/tests/storageAccess/request-storage-access-top-frame.html
29
30         * dom/Document.cpp:
31         (WebCore::Document::requestStorageAccess):
32         * dom/Document.h:
33         (WebCore::Document::hasStorageAccess const):
34         (WebCore::Document::setUserGrantsStorageAccessOverride):
35             See comments on WebCore::Internals below.
36         * dom/Document.idl:
37         * dom/SecurityContext.cpp:
38         (WebCore::SecurityContext::isSupportedSandboxPolicy):
39         (WebCore::SecurityContext::parseSandboxPolicy):
40             Support for allow-storage-access-by-user-activation.
41         * dom/SecurityContext.h:
42         * loader/ResourceLoadObserver.cpp:
43         (WebCore::ResourceLoadObserver::registerStorageAccess):
44             Newly granted storage access is reported to 
45             WebCore::ResourceLoadObserver.
46         * loader/ResourceLoadObserver.h:
47         * loader/ResourceLoadStatistics.cpp:
48         (WebCore::encodeHashSet):
49         (WebCore::ResourceLoadStatistics::encode const):
50         (WebCore::decodeHashSet):
51         (WebCore::ResourceLoadStatistics::decode):
52         (WebCore::appendHashSet):
53         (WebCore::ResourceLoadStatistics::toString const):
54         (WebCore::mergeHashSet):
55         (WebCore::ResourceLoadStatistics::merge):
56             Storage of the new type of data.
57         * loader/ResourceLoadStatistics.h:
58         * page/Settings.in:
59         * testing/Internals.cpp:
60         (WebCore::Internals::resetToConsistentState):
61         (WebCore::Internals::setUserGrantsStorageAccess):
62         * testing/Internals.h:
63         * testing/Internals.idl:
64             Added setUserGrantsStorageAccess(). It is used to
65             override the eventSender's keyboard input which
66             always results in a cancel action on the confirm()
67             dialog.
68
69 2017-09-13  Wenson Hsieh  <wenson_hsieh@apple.com>
70
71         Submitting a form can cause HTMLFormElement's associated elements vector to be mutated during iteration
72         https://bugs.webkit.org/show_bug.cgi?id=176368
73         <rdar://problem/34254998>
74
75         Reviewed by Ryosuke Niwa.
76
77         In the process of iterating over form.associatedElements() during form submission in FormSubmission::create, the
78         page may cause us to clobber the vector of FormAssociatedElements* we're currently iterating over by inserting
79         new form controls beneath the form element we're in the process of submitting. This happens because
80         FormSubmission::create calls HTMLTextAreaElement::appendFormData, which requires layout to be up to date, which
81         in turn makes us updateLayout() and set focus, which fires a `change` event, upon which the page's JavaScript
82         inserts additonal DOM nodes into the form, modifying the vector of associated elements.
83
84         To mitigate this, instead of iterating over HTMLFormElement::associatedElements(), which returns a reference to
85         the HTMLFormElement's actual m_associatedElements vector, we iterate over a new vector of
86         Ref<FormAssociatedElement>s created from m_associatedElements.
87
88         This patch also removes an event dispatch assertion added in r212026. This assertion was added to catch any
89         other events dispatched in this scope, since dispatching events there would have had security implications, but
90         after making iteration over associated elements robust, this NoEventDispatchAssertion is no longer useful.
91
92         Test: fast/forms/append-children-during-form-submission.html
93
94         * loader/FormSubmission.cpp:
95         (WebCore::FormSubmission::create):
96
97 2017-09-13  Devin Rousso  <webkit@devinrousso.com>
98
99         Web Inspector: Event Listeners section does not update when listeners are added/removed
100         https://bugs.webkit.org/show_bug.cgi?id=170570
101         <rdar://problem/31501645>
102
103         Reviewed by Joseph Pecoraro.
104
105         Test: inspector/dom/event-listener-add-remove.html
106
107         * dom/EventTarget.cpp:
108         (WebCore::EventTarget::setAttributeEventListener):
109         Fire willRemoveEventListener/didAddEventListener events when an attribute event listener is
110         replaced by another event listener.
111
112         * inspector/InspectorDOMAgent.h:
113         * inspector/InspectorDOMAgent.cpp:
114         (WebCore::InspectorDOMAgent::didAddEventListener):
115         (WebCore::InspectorDOMAgent::willRemoveEventListener):
116         Dispatch an event to the inspector frontend whenever an event listener is added/removed.
117
118         * inspector/InspectorInstrumentation.cpp:
119         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
120         (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl):
121         Tie into existing instrumentation points for adding/removing event listeners.
122
123 2017-09-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
124
125         [Curl] Bug fix for synchronous transfer
126         https://bugs.webkit.org/show_bug.cgi?id=176552
127
128         Reviewed by Alex Christensen.
129
130         ResourceHandleInternal::m_delegate is null when transfer is synchronous. It should be set ResourceHandleCurlDelegate.
131         Also the callback functions called when transfer is completed is wrong.
132
133         * platform/network/curl/ResourceHandleCurl.cpp:
134         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
135         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
136         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
137         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
138         (WebCore::ResourceHandleCurlDelegate::notifyFail):
139         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
140         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
141         (WebCore::ResourceHandleCurlDelegate::willSendData):
142
143 2017-09-13  Matt Lewis  <jlewis3@apple.com>
144
145         Unreviewed, rolling out r221976.
146
147         The test introduced was flaky from point of addition.
148
149         Reverted changeset:
150
151         "Introduce Storage Access API (document parts) as an
152         experimental feature"
153         https://bugs.webkit.org/show_bug.cgi?id=175759
154         http://trac.webkit.org/changeset/221976
155
156 2017-09-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
157
158         Followup (r221805): Address comments and add more tests
159         https://bugs.webkit.org/show_bug.cgi?id=176732
160
161         Reviewed by Darin Adler.
162
163         Test: http/tests/images/decode-slow-load-static-image.html
164
165         Code clean up and adding a new test to ensure multiple decode() promises
166         can be resolved or rejected simultaneously without any issues.
167
168         * loader/ImageLoader.cpp:
169         (WebCore::ImageLoader::decode):
170         (WebCore::ImageLoader::decodeError):
171         * loader/ImageLoader.h:
172         * platform/graphics/BitmapImage.cpp:
173         (WebCore::BitmapImage::decode):
174         (WebCore::BitmapImage::callDecodingCallbacks):
175         * platform/graphics/BitmapImage.h:
176
177 2017-09-13  Youenn Fablet  <youenn@apple.com>
178
179         Internals clearCacheStorageMemoryRepresentation should return a Promise
180         https://bugs.webkit.org/show_bug.cgi?id=176818
181
182         Reviewed by Alex Christensen.
183
184         No observable change of behavior.
185
186         * Modules/cache/DOMCacheEngine.h:
187         * testing/Internals.cpp:
188         (WebCore::Internals::clearCacheStorageMemoryRepresentation): Returning a promise when clearing is completed.
189         * testing/Internals.h:
190         * testing/Internals.idl:
191
192 2017-09-13  Nikita Vasilyev  <nvasilyev@apple.com>
193
194         Web Inspector: Frontend should be made to expect and handle disabled properties
195         https://bugs.webkit.org/show_bug.cgi?id=166787
196         <rdar://problem/34379593>
197
198         Reviewed by Joseph Pecoraro.
199
200         Include disabled (commented out) CSS properties in the payload.
201
202         Tests: inspector/css/css-property.html
203                inspector/css/matched-style-properties.html
204
205         * inspector/InspectorStyleSheet.cpp:
206         (WebCore::InspectorStyle::populateAllProperties const):
207         (WebCore::InspectorStyle::styleWithProperties const):
208
209 2017-09-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
210
211         [GTK] Fails to build because 'Float32Array' has not been declared in AudioContext.h
212         https://bugs.webkit.org/show_bug.cgi?id=176870
213
214         Reviewed by Konstantin Tokarev.
215
216         Add missing include of Float32Array.h
217
218         No new tests, its a build fix.
219
220         * Modules/webaudio/AudioContext.h:
221
222 2017-09-13  Andy Estes  <aestes@apple.com>
223
224         [CF] Upstream CFNetwork-related WebKitSystemInterface functions
225         https://bugs.webkit.org/show_bug.cgi?id=176729
226
227         Reviewed by Alex Christensen.
228
229         * platform/ios/WebCoreSystemInterfaceIOS.mm:
230         * platform/mac/PublicSuffixMac.mm:
231         (WebCore::isPublicSuffix):
232         * platform/mac/WebCoreSystemInterface.h:
233         * platform/mac/WebCoreSystemInterface.mm:
234         * platform/network/cf/ResourceRequestCFNet.cpp:
235         (WebCore::ResourceRequest::doUpdatePlatformRequest):
236         (WebCore::ResourceRequest::doUpdateResourceRequest):
237         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
238         (WebCore::setCONNECTProxyForStream):
239         (WebCore::SocketStreamHandleImpl::createStreams):
240         (WebCore::setCONNECTProxyAuthorizationForStream):
241         (WebCore::SocketStreamHandleImpl::addCONNECTCredentials):
242         (WebCore::copyCONNECTProxyResponse):
243         (WebCore::SocketStreamHandleImpl::readStreamCallback):
244         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
245         * platform/network/cocoa/ResourceRequestCocoa.mm:
246         (WebCore::ResourceRequest::doUpdateResourceRequest):
247         (WebCore::ResourceRequest::doUpdatePlatformRequest):
248
249 2017-09-13  Antti Koivisto  <antti@apple.com>
250
251         Make more of the CSS animation system internals element based
252         https://bugs.webkit.org/show_bug.cgi?id=176832
253
254         Reviewed by Zalan Bujtas.
255
256         CSS animations animate element style. Continue moving away from renderers in the animation code.
257
258         Also do some general modernization.
259
260         * css/CSSComputedStyleDeclaration.cpp:
261         (WebCore::computeRenderStyleForProperty):
262         * page/animation/AnimationBase.cpp:
263         (WebCore::AnimationBase::AnimationBase):
264         * page/animation/AnimationBase.h:
265         * page/animation/CSSAnimationController.cpp:
266         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
267         (WebCore::CSSAnimationControllerPrivate::clear):
268         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
269         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForElement):
270         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
271         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
272         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
273         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
274         (WebCore::CSSAnimationControllerPrivate::animatedStyleForElement):
275         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
276         (WebCore::CSSAnimationController::cancelAnimations):
277         (WebCore::CSSAnimationController::updateAnimations):
278         (WebCore::CSSAnimationController::animatedStyleForRenderer):
279         (WebCore::CSSAnimationController::computeExtentOfAnimation const):
280         (WebCore::CSSAnimationController::pauseAnimationAtTime):
281         (WebCore::CSSAnimationController::pauseTransitionAtTime):
282         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForRenderer): Deleted.
283         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer): Deleted.
284         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer): Deleted.
285         * page/animation/CSSAnimationController.h:
286         * page/animation/CSSAnimationControllerPrivate.h:
287         * page/animation/CompositeAnimation.cpp:
288         (WebCore::CompositeAnimation::~CompositeAnimation):
289         (WebCore::CompositeAnimation::clearElement):
290         (WebCore::CompositeAnimation::updateTransitions):
291         (WebCore::CompositeAnimation::updateKeyframeAnimations):
292         (WebCore::CompositeAnimation::animate):
293         (WebCore::CompositeAnimation::clearRenderer): Deleted.
294         * page/animation/CompositeAnimation.h:
295         * page/animation/ImplicitAnimation.cpp:
296         (WebCore::ImplicitAnimation::ImplicitAnimation):
297         (WebCore::ImplicitAnimation::animate):
298         * page/animation/ImplicitAnimation.h:
299         (WebCore::ImplicitAnimation::create):
300         * page/animation/KeyframeAnimation.cpp:
301         (WebCore::KeyframeAnimation::KeyframeAnimation):
302         (WebCore::KeyframeAnimation::animate):
303         * page/animation/KeyframeAnimation.h:
304         * rendering/RenderElement.cpp:
305         (WebCore::RenderElement::willBeDestroyed):
306         * rendering/RenderLayer.cpp:
307         (WebCore::RenderLayer::currentTransform const):
308         * style/RenderTreeUpdater.cpp:
309         (WebCore::RenderTreeUpdater::createRenderer):
310         * style/StyleTreeResolver.cpp:
311         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
312         * testing/Internals.cpp:
313         (WebCore::Internals::pauseAnimationAtTimeOnElement):
314         (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
315         (WebCore::Internals::pauseTransitionAtTimeOnElement):
316         (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):
317
318 2017-09-13  Daniel Bates  <dabates@apple.com>
319
320         Make history.pushState()/replaceState() more closely aligned to the HTML standard
321         https://bugs.webkit.org/show_bug.cgi?id=176730
322         <rdar://problem/33839265>
323
324         Reviewed by Alex Christensen.
325
326         Update history.pushState()/replaceState() to more closely align with the algorithm
327         specified in <https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate-2> (9 September 2017).
328
329         Test: http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html
330
331         * page/History.cpp:
332         (WebCore::History::stateObjectAdded):
333         * page/SecurityOrigin.cpp:
334         (WebCore::SecurityOrigin::extractInnerURL): Use URL constructor that takes a base URL as opposed
335         to using the special ParsedURLString-variant because the latter can only be used to parse a string
336         returned from URL::string(). And the extracted inner URL does not meet this criterion. Using the
337         ParsedURLString-variant of the URL constructor with a string that is not the result of URL::string()
338         will cause an assertion failure in a debug build.
339
340 2017-09-13  John Wilander  <wilander@apple.com>
341
342         Introduce Storage Access API (document parts) as an experimental feature
343         https://bugs.webkit.org/show_bug.cgi?id=175759
344         <rdar://problem/33666847>
345
346         Reviewed by Alex Christensen.
347
348         Storage Access API is an experimental feature which allows cross-origin,
349         sandboxed iframes to request access to their first-party storage (as
350         opposed to partitioned storage). This might be restricted to cookies or
351         might cover all stateful mechanisms.
352
353         It introduces the following three developer-facing things:
354         - A new readonly attribute, document.hasStorageAccess.
355         - A new function, document.requestStorageAccess().
356         - A new iframe sandbox token, allow-storage-access-by-user-activation.
357
358         Tests: http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-iframe.html
359                http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
360                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-iframe.html
361                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
362                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
363                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
364                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-iframe.html
365                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
366                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe.html
367                http/tests/loading/resourceLoadStatistics/request-storage-access-top-frame.html
368
369         * dom/Document.cpp:
370         (WebCore::Document::requestStorageAccess):
371         * dom/Document.h:
372         (WebCore::Document::hasStorageAccess const):
373         (WebCore::Document::setUserGrantsStorageAccessOverride):
374             See comments on WebCore::Internals below.
375         * dom/Document.idl:
376         * dom/SecurityContext.cpp:
377         (WebCore::SecurityContext::isSupportedSandboxPolicy):
378         (WebCore::SecurityContext::parseSandboxPolicy):
379             Support for allow-storage-access-by-user-activation.
380         * dom/SecurityContext.h:
381         * loader/ResourceLoadObserver.cpp:
382         (WebCore::ResourceLoadObserver::registerStorageAccess):
383             Newly granted storage access is reported to 
384             WebCore::ResourceLoadObserver.
385         * loader/ResourceLoadObserver.h:
386         * loader/ResourceLoadStatistics.cpp:
387         (WebCore::encodeHashSet):
388         (WebCore::ResourceLoadStatistics::encode const):
389         (WebCore::decodeHashSet):
390         (WebCore::ResourceLoadStatistics::decode):
391         (WebCore::appendHashSet):
392         (WebCore::ResourceLoadStatistics::toString const):
393         (WebCore::mergeHashSet):
394         (WebCore::ResourceLoadStatistics::merge):
395             Storage of the new type of data.
396         * loader/ResourceLoadStatistics.h:
397         * page/Settings.in:
398         * testing/Internals.cpp:
399         (WebCore::Internals::resetToConsistentState):
400         (WebCore::Internals::setUserGrantsStorageAccess):
401         * testing/Internals.h:
402         * testing/Internals.idl:
403             Added setUserGrantsStorageAccess(). It is used to
404             override the eventSender's keyboard input which
405             always results in a cancel action on the confirm()
406             dialog.
407
408 2017-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
409
410         [HarfBuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition in some cases
411         https://bugs.webkit.org/show_bug.cgi?id=176848
412
413         Reviewed by Michael Catanzaro.
414
415         This patch rewrites HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition() to make it simpler and ensure we
416         return the right offset in all the cases, also honoring now the includePartialGlyphs parameter that we were
417         ignoring in FontCascade::offsetForPositionForComplexText().
418
419         Fixes several tests that started to fail after r221909.
420
421         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
422         (WebCore::FontCascade::offsetForPositionForComplexText const):
423         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
424         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
425         (WebCore::HarfBuzzShaper::offsetForPosition):
426         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
427
428 2017-09-13  Per Arne Vollan  <pvollan@apple.com>
429
430         Initialize InternalSettings member variable.
431         https://bugs.webkit.org/show_bug.cgi?id=176838
432
433         Reviewed by Brent Fulgham.
434
435         Initialize the m_webVREnabled member in the constructor.
436
437         * testing/InternalSettings.cpp:
438         (WebCore::InternalSettings::Backup::Backup):
439
440 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
441
442         Make WebGLRenderingContextBase::TypedList::data() const-correct.
443         https://bugs.webkit.org/show_bug.cgi?id=176833
444
445         Reviewed by Sam Weinig.
446
447         No change of behavior.
448
449         * html/canvas/WebGLRenderingContextBase.cpp:
450         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
451         * html/canvas/WebGLRenderingContextBase.h:
452         (WebCore::WebGLRenderingContextBase::TypedList::data const):
453         * platform/graphics/GraphicsContext3D.h:
454         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
455         (WebCore::GraphicsContext3D::uniform1fv):
456         (WebCore::GraphicsContext3D::uniform2fv):
457         (WebCore::GraphicsContext3D::uniform3fv):
458         (WebCore::GraphicsContext3D::uniform4fv):
459         (WebCore::GraphicsContext3D::uniform1iv):
460         (WebCore::GraphicsContext3D::uniform2iv):
461         (WebCore::GraphicsContext3D::uniform3iv):
462         (WebCore::GraphicsContext3D::uniform4iv):
463         (WebCore::GraphicsContext3D::uniformMatrix2fv):
464         (WebCore::GraphicsContext3D::uniformMatrix3fv):
465         (WebCore::GraphicsContext3D::uniformMatrix4fv):
466         (WebCore::GraphicsContext3D::vertexAttrib1fv):
467         (WebCore::GraphicsContext3D::vertexAttrib2fv):
468         (WebCore::GraphicsContext3D::vertexAttrib3fv):
469         (WebCore::GraphicsContext3D::vertexAttrib4fv):
470
471 2017-09-13  Sam Weinig  <sam@webkit.org>
472
473         Remove CanvasRenderingContext2D.commit(), it is a no-op and not part the standard
474         https://bugs.webkit.org/show_bug.cgi?id=176821
475
476         Reviewed by Darin Adler.
477
478         * html/canvas/CanvasRenderingContext2D.h:
479         * html/canvas/CanvasRenderingContext2D.idl:
480         
481             Remove the commit operation. It is no longer part the standard (it was
482             moved to OffscreenCanvasRenderingContext2D) and it was a no-op.
483
484 2017-09-12  Matt Rajca  <mrajca@apple.com>
485
486         Ensure the user interacted with the page before setting m_userHasInteractedWithMediaElement
487         https://bugs.webkit.org/show_bug.cgi?id=176816
488
489         Reviewed by Eric Carlson.
490
491         Currently, when the user presses a keyboard shortcut in the client to reload a page, that may
492         get registered as a user gesture on the reloaded page. Before setting the
493         m_userHasInteractedWithMediaElement flag, we should check if a user gesture was actually handled
494         by checking the userDidInteractWithPage flag. In case of key events that aren't handled by the
495         page, this will be set to false by EventHandler:
496
497             // If the key event was not handled, do not treat it as user interaction with the page.
498             if (topDocument && !wasHandled)
499                 topDocument->setUserDidInteractWithPage(savedUserDidInteractWithPage);
500
501         We need to revisit this in the future in webkit.org/b/176817 and ensure user gesture tokens
502         don't carry over across reloads of the page.
503
504         Tests: I wasn't able to trigger the pathological scenario this aims to fix with a test that calls
505         window.location.reload() from a synthetic keyDown event.
506
507         * dom/Document.cpp:
508         (WebCore::Document::noteUserInteractionWithMediaElement):
509
510 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
511
512         Disallow passing null values to various WebGL2 methods.
513         https://bugs.webkit.org/show_bug.cgi?id=176829
514
515         Reviewed by Yusuke Suzuki.
516
517         This matches the specification as well as Gecko and Chromium.
518
519         Test: fast/canvas/webgl/webgl2/bindings.html
520
521         * html/canvas/WebGL2RenderingContext.cpp:
522         (WebCore::WebGL2RenderingContext::beginQuery):
523         (WebCore::WebGL2RenderingContext::getQueryParameter):
524         (WebCore::WebGL2RenderingContext::samplerParameteri):
525         (WebCore::WebGL2RenderingContext::samplerParameterf):
526         (WebCore::WebGL2RenderingContext::getSamplerParameter):
527         (WebCore::WebGL2RenderingContext::clientWaitSync):
528         (WebCore::WebGL2RenderingContext::waitSync):
529         (WebCore::WebGL2RenderingContext::getSyncParameter):
530         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
531         (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
532         (WebCore::WebGL2RenderingContext::getUniformIndices):
533         (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
534         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
535         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
536         (WebCore::WebGL2RenderingContext::uniformBlockBinding):
537         * html/canvas/WebGL2RenderingContext.h:
538         * html/canvas/WebGL2RenderingContext.idl:
539
540 2017-09-13  Sergio Villar Senin  <svillar@igalia.com>
541
542         [WebVR] Add IDLs and stubs
543         https://bugs.webkit.org/show_bug.cgi?id=174202
544
545         Reviewed by Dean Jackson.
546
547         Adding the complete set of IDLs for the WebVR 1.1 spec including the interface stubs which
548         currently do nothing.
549
550         Tests: webvr/webvr-disabled.html
551                webvr/webvr-enabled.html
552
553         * CMakeLists.txt:
554         * DerivedSources.make:
555         * Modules/webvr/DOMWindowWebVR.idl: Added.
556         * Modules/webvr/GamepadWebVR.cpp: Added.
557         (WebCore::GamepadWebVR::GamepadWebVR):
558         (WebCore::GamepadWebVR::~GamepadWebVR):
559         (WebCore::GamepadWebVR::displayId):
560         * Modules/webvr/GamepadWebVR.h: Added.
561         * Modules/webvr/GamepadWebVR.idl: Added.
562         * Modules/webvr/NavigatorWebVR.cpp: Added.
563         (WebCore::NavigatorWebVR::getVRDisplays):
564         (WebCore::NavigatorWebVR::activeVRDisplays):
565         (WebCore::NavigatorWebVR::vrEnabled):
566         * Modules/webvr/NavigatorWebVR.h: Added.
567         * Modules/webvr/NavigatorWebVR.idl: Added.
568         * Modules/webvr/VRDisplay.cpp: Added.
569         (WebCore::VRDisplay::create):
570         (WebCore::VRDisplay::VRDisplay):
571         (WebCore::VRDisplay::isConnected const):
572         (WebCore::VRDisplay::isPresenting const):
573         (WebCore::VRDisplay::capabilities const):
574         (WebCore::VRDisplay::stageParameters const):
575         (WebCore::VRDisplay::getEyeParameters const):
576         (WebCore::VRDisplay::displayId const):
577         (WebCore::VRDisplay::displayName const):
578         (WebCore::VRDisplay::getFrameData const):
579         (WebCore::VRDisplay::getPose const):
580         (WebCore::VRDisplay::resetPose):
581         (WebCore::VRDisplay::depthNear const):
582         (WebCore::VRDisplay::setDepthNear):
583         (WebCore::VRDisplay::depthFar const):
584         (WebCore::VRDisplay::setDepthFar):
585         (WebCore::VRDisplay::requestAnimationFrame):
586         (WebCore::VRDisplay::cancelAnimationFrame):
587         (WebCore::VRDisplay::requestPresent):
588         (WebCore::VRDisplay::exitPresent):
589         (WebCore::VRDisplay::getLayers const):
590         (WebCore::VRDisplay::submitFrame):
591         (WebCore::VRDisplay::hasPendingActivity const):
592         (WebCore::VRDisplay::activeDOMObjectName const):
593         (WebCore::VRDisplay::canSuspendForDocumentSuspension const):
594         (WebCore::VRDisplay::stop):
595         * Modules/webvr/VRDisplay.h: Added.
596         * Modules/webvr/VRDisplay.idl: Added.
597         * Modules/webvr/VRDisplayCapabilities.cpp: Added.
598         (WebCore::VRDisplayCapabilities::hasPosition const):
599         (WebCore::VRDisplayCapabilities::hasOrientation const):
600         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
601         (WebCore::VRDisplayCapabilities::canPresent const):
602         (WebCore::VRDisplayCapabilities::maxLayer const):
603         * Modules/webvr/VRDisplayCapabilities.h: Added.
604         (WebCore::VRDisplayCapabilities::create):
605         * Modules/webvr/VRDisplayCapabilities.idl: Added.
606         * Modules/webvr/VRDisplayEvent.cpp: Added.
607         (WebCore::VRDisplayEvent::VRDisplayEvent):
608         (WebCore::VRDisplayEvent::display const):
609         (WebCore::VRDisplayEvent::reason const):
610         (WebCore::VRDisplayEvent::eventInterface const):
611         * Modules/webvr/VRDisplayEvent.h: Added.
612         * Modules/webvr/VRDisplayEvent.idl: Added.
613         * Modules/webvr/VRDisplayEventReason.h: Added.
614         * Modules/webvr/VRDisplayEventReason.idl: Added.
615         * Modules/webvr/VREye.h: Added.
616         * Modules/webvr/VREye.idl: Added.
617         * Modules/webvr/VREyeParameters.cpp: Added.
618         (WebCore::VREyeParameters::VREyeParameters):
619         (WebCore::VREyeParameters::offset const):
620         (WebCore::VREyeParameters::fieldOfView const):
621         (WebCore::VREyeParameters::renderWidth const):
622         (WebCore::VREyeParameters::renderHeight const):
623         * Modules/webvr/VREyeParameters.h: Added.
624         (WebCore::VREyeParameters::create):
625         * Modules/webvr/VREyeParameters.idl: Added.
626         * Modules/webvr/VRFieldOfView.cpp: Added.
627         (WebCore::VRFieldOfView::upDegrees const):
628         (WebCore::VRFieldOfView::rightDegrees const):
629         (WebCore::VRFieldOfView::downDegrees const):
630         (WebCore::VRFieldOfView::leftDegrees const):
631         * Modules/webvr/VRFieldOfView.h: Added.
632         (WebCore::VRFieldOfView::create):
633         * Modules/webvr/VRFieldOfView.idl: Added.
634         * Modules/webvr/VRFrameData.cpp: Added.
635         (WebCore::VRFrameData::VRFrameData):
636         (WebCore::VRFrameData::timestamp const):
637         (WebCore::VRFrameData::leftProjectionMatrix const):
638         (WebCore::VRFrameData::leftViewMatrix const):
639         (WebCore::VRFrameData::rightProjectionMatrix const):
640         (WebCore::VRFrameData::rightViewMatrix const):
641         (WebCore::VRFrameData::pose const):
642         * Modules/webvr/VRFrameData.h: Added.
643         (WebCore::VRFrameData::create):
644         * Modules/webvr/VRFrameData.idl: Added.
645         * Modules/webvr/VRLayerInit.h: Added.
646         * Modules/webvr/VRLayerInit.idl: Added.
647         * Modules/webvr/VRPose.cpp: Added.
648         (WebCore::VRPose::position const):
649         (WebCore::VRPose::linearVelocity const):
650         (WebCore::VRPose::linearAcceleration const):
651         (WebCore::VRPose::orientation const):
652         (WebCore::VRPose::angularVelocity const):
653         (WebCore::VRPose::angularAcceleration const):
654         * Modules/webvr/VRPose.h: Added.
655         (WebCore::VRPose::create):
656         * Modules/webvr/VRPose.idl: Added.
657         * Modules/webvr/VRStageParameters.cpp: Added.
658         (WebCore::VRStageParameters::sittingToStandingTransform const):
659         (WebCore::VRStageParameters::sizeX const):
660         (WebCore::VRStageParameters::sizeZ const):
661         * Modules/webvr/VRStageParameters.h: Added.
662         (WebCore::VRStageParameters::create):
663         * Modules/webvr/VRStageParameters.idl: Added.
664         * WebCore.xcodeproj/project.pbxproj:
665         * bindings/js/WebCoreBuiltinNames.h:
666         * dom/EventNames.h:
667         * dom/EventNames.in:
668         * dom/EventTargetFactory.in:
669         * features.json:
670         * page/RuntimeEnabledFeatures.h:
671         (WebCore::RuntimeEnabledFeatures::setWebVREnabled):
672         (WebCore::RuntimeEnabledFeatures::webVREnabled const):
673         * testing/InternalSettings.cpp:
674         (WebCore::InternalSettings::Backup::restoreTo):
675         (WebCore::InternalSettings::setWebVREnabled):
676         * testing/InternalSettings.h:
677         * testing/InternalSettings.idl:
678
679 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
680
681         Update the type of the texture argument to framebufferTextureLayer().
682         https://bugs.webkit.org/show_bug.cgi?id=176785
683
684         Reviewed by Yusuke Suzuki.
685
686         This matches the specification as well as Gecko and Chromium.
687
688         Also move getInternalformatParameter() to the position it has in the
689         specification, for easier comparison.
690
691         Test: fast/canvas/webgl/webgl2/bindings.html
692
693         * html/canvas/WebGL2RenderingContext.cpp:
694         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
695         * html/canvas/WebGL2RenderingContext.h:
696         * html/canvas/WebGL2RenderingContext.idl:
697
698 2017-09-13  Zan Dobersek  <zdobersek@igalia.com>
699
700         [EME] Implement CDMInstanceClearKey::updateLicense()
701         https://bugs.webkit.org/show_bug.cgi?id=176791
702
703         Reviewed by Xabier Rodriguez-Calvar.
704
705         Implement the updateLicense() method for CDMInstanceClearKey.
706         The response data is parsed as JSON, matching that agains either
707         'license' or 'license release acknowledgement' formats (depending
708         on either 'keys' or 'kids' object keys being present). If any
709         format is recognized, appropriate steps are taken.
710
711         In case of the 'license' format, the passed-in keys are matched
712         against existing ones. If some keys have changed or have been
713         newly introduced, the key information is sorted by key ID size
714         and data to enforce order. After that the KeyStatusVector object
715         is constructed, containing key ID and status information for all
716         the keys associated with this session. Finally callback is
717         dispatched, signalling a successful operation and passing the
718         KeyStatusVector, if any, back to the caller.
719
720         In case of the 'license release acknowledgement' format, the
721         session data for this session ID is removed from the ClearKey state
722         singleton. The callback is dispatched signalling the session closure
723         and successfull completion of the operation.
724
725         Finally, if no format is deduced, the callback is again dispatched,
726         but now signalling an operation failure.
727
728         No new tests -- expectations for the relevant tests are updated
729         to reflect the introduced changes.
730
731         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
732         (WebCore::ClearKeyState::keys):
733         (WebCore::ClearKeyState::singleton):
734         (WebCore::parseLicenseFormat):
735         (WebCore::parseLicenseReleaseAcknowledgementFormat):
736         (WebCore::CDMInstanceClearKey::updateLicense):
737
738 2017-09-13  Ryosuke Niwa  <rniwa@webkit.org>
739
740         Refactor WebContentReader out of EditorMac and EditorIOS
741         https://bugs.webkit.org/show_bug.cgi?id=176770
742
743         Reviewed by Sam Weinig.
744
745         Extracted WebContentReader.h, WebContentReaderMac.mm, and WebContentIOS.mm from Pasteboard.h,
746         EditorMac.mm, and EditorIOS.mm respectively.
747
748         Also moved createFragmentAndAddResources from EditorCocoa.mm to WebContentReaderCocoa.mm
749         and createFragmentForImageAndURL and createFragmentForImageResourceAndAddResource to markup.cpp.
750
751         * Configurations/WebCore.xcconfig:
752         * PlatformMac.cmake:
753         * WebCore.xcodeproj/project.pbxproj:
754         * editing/Editor.cpp:
755         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
756         * editing/Editor.h:
757         * editing/WebContentReader.h: Added.
758         * editing/cocoa/EditorCocoa.mm:
759         (WebCore::Editor::replaceSelectionWithAttributedString):
760         (WebCore::Editor::createFragment): Deleted.
761         (WebCore::Editor::createFragmentForImageResourceAndAddResource): Deleted.
762         (WebCore::Editor::createFragmentAndAddResources): Deleted.
763         * editing/cocoa/WebContentReaderCocoa.mm: Added.
764         (WebCore::createFragmentForImageResourceAndAddResource):
765         (WebCore::createFragment):
766         (WebCore::createFragmentAndAddResources):
767         * editing/ios/EditorIOS.mm:
768         (WebCore::Editor::WebContentReader): Moved to WebContentReaderIOS.mm.
769         * editing/ios/WebContentReaderIOS.mm: Added.
770         (WebCore::WebContentReader::addFragment):
771         (WebCore::WebContentReader::readWebArchive):
772         (WebCore::WebContentReader::readFilenames):
773         (WebCore::WebContentReader::readHTML):
774         (WebCore::WebContentReader::readRTFD):
775         (WebCore::WebContentReader::readRTF):
776         (WebCore::WebContentReader::readImage):
777         (WebCore::WebContentReader::readURL):
778         (WebCore::WebContentReader::readPlainText):
779         * editing/mac/EditorMac.mm:
780         (WebCore::Editor::WebContentReader): Moved to WebContentReaderMac.mm.
781         * editing/mac/WebContentReaderMac.mm: Added.
782         (WebCore::WebContentReader::readWebArchive):
783         (WebCore::WebContentReader::readFilenames):
784         (WebCore::WebContentReader::readHTML):
785         (WebCore::WebContentReader::readRTFD):
786         (WebCore::WebContentReader::readRTF):
787         (WebCore::WebContentReader::readImage):
788         (WebCore::WebContentReader::readURL):
789         (WebCore::WebContentReader::readPlainText):
790         * editing/markup.cpp:
791         (WebCore::createFragmentForImageAndURL):
792         (WebCore::createFragmentForImageResourceAndAddResource):
793         * editing/markup.h:
794
795 2017-09-12  Yusuke Suzuki  <utatane.tea@gmail.com>
796
797         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
798         https://bugs.webkit.org/show_bug.cgi?id=176010
799
800         Reviewed by Filip Pizlo.
801
802         * platform/network/curl/CurlJobManager.cpp:
803         (WebCore::CurlJobList::finishJobs):
804
805 2017-09-12  Frederic Wang  <fwang@igalia.com>
806
807         Rename isRootLayer to isRenderViewLayer
808         https://bugs.webkit.org/show_bug.cgi?id=176684
809
810         Reviewed by Darin Adler.
811
812         This patch was generated with the help of do-webcore-rename with some coding style adjustment.
813
814         No new tests, behavior unchanged.
815
816         * rendering/RenderLayer.cpp:
817         (WebCore::RenderLayer::RenderLayer):
818         (WebCore::RenderLayer::enclosingTransformedAncestor const):
819         (WebCore::RenderLayer::enclosingFilterRepaintLayer const):
820         (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
821         (WebCore::RenderLayer::clippingRootForPainting const):
822         (WebCore::RenderLayer::beginTransparencyLayers):
823         (WebCore::shouldSuppressPaintingLayer):
824         (WebCore::RenderLayer::paintFixedLayersInNamedFlows):
825         (WebCore::RenderLayer::hitTest):
826         (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
827         (WebCore::RenderLayer::calculateClipRects const):
828         * rendering/RenderLayer.h:
829         * rendering/RenderLayerBacking.cpp:
830         (WebCore::RenderLayerBacking::RenderLayerBacking):
831         (WebCore::RenderLayerBacking::updateConfiguration):
832         (WebCore::RenderLayerBacking::updateAfterDescendants):
833         (WebCore::RenderLayerBacking::paintsIntoWindow const):
834         (WebCore::RenderLayerBacking::paintIntoLayer):
835         * rendering/RenderLayerCompositor.cpp:
836         (WebCore::RenderLayerCompositor::logLayerInfo):
837         (WebCore::RenderLayerCompositor::needsCompositingUpdateForStyleChangeOnNonCompositedLayer const):
838         (WebCore::RenderLayerCompositor::updateBacking):
839         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
840         (WebCore::RenderLayerCompositor::addToOverlapMap):
841         (WebCore::RenderLayerCompositor::computeCompositingRequirementsForNamedFlowFixed):
842         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
843         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTreeForNamedFlowFixed):
844         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
845         (WebCore::RenderLayerCompositor::needsToBeComposited const):
846         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const): Also move the IOS condition
847         up to avoid that check-webkit-style complains.
848         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
849         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
850         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
851         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
852
853 2017-09-12  Wenson Hsieh  <wenson_hsieh@apple.com>
854
855         [iOS DnD] Support DataTransfer.getData and DataTransfer.setData when dragging or dropping
856         https://bugs.webkit.org/show_bug.cgi?id=176672
857         <rdar://problem/34353723>
858
859         Reviewed by Ryosuke Niwa.
860
861         Makes several tweaks to support DataTransfer.getData and DataTransfer.setData when dragging and dropping on iOS.
862         See per-method changes below for more details. This patch also renames some old variable and property names
863         along the way, so they no longer reference "data interaction", and instead refer to the feature by its post-WWDC
864         name.
865
866         New test: DataInteractionTests.ExternalSourceInlineTextToFileInput
867         Modified: DataInteractionTests.CanStartDragOnDivWithDraggableAttribute
868                   DataInteractionTests.SinglePlainTextURLTypeIdentifiers
869                   DataInteractionTests.SinglePlainTextWordTypeIdentifiers
870
871         * platform/ios/AbstractPasteboard.h:
872         * platform/ios/PasteboardIOS.mm:
873         (WebCore::cocoaTypeFromHTMLClipboardType):
874
875         In cocoaTypeFromHTMLClipboardType, map the "text/plain" MIME type to the "public.plain-text" UTI. Previously,
876         this corresponded to "public.text", which is incorrect, since "public.text" also includes non-plain-text types
877         such as "public.html", thereby confusing NSItemProviders. Importantly, this makes it so that plain text strings
878         written via DataTransfer.setData() can actually be read back as a cocoa value, since "public.plain-text" is one
879         of the UTIs in +[NSString readableTypeIdentifiersForItemProvider].
880
881         (WebCore::Pasteboard::writeString):
882
883         Instead of writing { type : data } to the pasteboard, write { cocoaType : data }. It appears that this was
884         changed unintentionally in r156588 when upstreaming the iOS pasteboard implementation. This is made apparent by
885         how Pasteboard::readString() requests the cocoa UTI from the platform pasteboard, but Pasteboard::writeString()
886         sends the MIME type.
887
888         * platform/ios/PlatformPasteboardIOS.mm:
889         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
890         (WebCore::PlatformPasteboard::write):
891
892         When writing plain text or a URL, specify that the item wants inline style representation. This prevents odd and
893         unexpected behaviors (for instance, being able to drag plain text into the Files app as a file), but it also
894         makes getData() not bail and return the null string on drop, due to forFileDrag() being true in
895         DataTransfer::getData().
896
897         * platform/ios/WebItemProviderPasteboard.h:
898         * platform/ios/WebItemProviderPasteboard.mm:
899         (-[WebItemProviderRegistrationInfoList init]):
900         (uiPreferredPresentationStyle):
901         (-[WebItemProviderRegistrationInfoList itemProvider]):
902
903         Set the preferred presentation style when generating an item provider from a registration list.
904
905         (+[WebItemProviderLoadResult emptyLoadResult]):
906         (+[WebItemProviderLoadResult loadResultWithFileURLMap:presentationStyle:]):
907         (-[WebItemProviderLoadResult initWithFileURLMap:presentationStyle:]):
908         (-[WebItemProviderLoadResult fileURLForType:]):
909         (-[WebItemProviderLoadResult loadedFileURLs]):
910         (-[WebItemProviderLoadResult loadedTypeIdentifiers]):
911
912         Introduce WebItemProviderLoadResult, an object that encapsulates information needed to represent the contents of
913         an NSItemProvider dropped in web content. Previously, WebItemProviderPasteboard maintained an array of
914         dictionaries of UTI => file URL, where each dictionary represents where the dropped data for a given item
915         provider lives. Now that we additionally need to remember (for each item provider) whether we should consider
916         its data as a file upload, it's more helpful to have a separate object representing the "load results" of a
917         dropped item provider.
918
919         (-[WebItemProviderPasteboard init]):
920         (-[WebItemProviderPasteboard pasteboardTypes]):
921         (-[WebItemProviderPasteboard setItemProviders:]):
922         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
923         (-[WebItemProviderPasteboard droppedFileURLs]):
924
925         Respect item provider load results that should not be exposed as a file to the page.
926
927         (-[WebItemProviderPasteboard numberOfFiles]):
928
929         Respect item providers with UIPreferredPresentationStyleInline by not counting them towards the number of files.
930
931         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
932
933         Adjust for the transition from an array of dictionaries representing loaded item providers to an array of
934         WebItemProviderLoadResults.
935
936         (-[WebItemProviderPasteboard fileURLsForDataInteraction]): Deleted.
937         * platform/mac/DragDataMac.mm:
938         (WebCore::DragData::containsFiles const):
939
940         DragData::containsFiles previously only considered whether or not particular UTIs appear in the pasteboard. In
941         the case of Mac, this is NSFilesPromisePboardType and NSFilenamesPboardType, but in the case of iOS, this is a
942         much broader category (anything conforming to "public.content"), since files are not exposed explicitly as
943         "promise" or "file" types in the list of registered UTIs. This caused us to always bail in
944         DataTransfer.getData() on drop on iOS, since we will always believe there's a file on the pasteboard if there's
945         anything conforming to "public.content" at all.
946
947         To fix this and simplify the code at the same time, we simply replace the currently implementation of
948         DragData::containsFiles to return true iff the number of files is nonzero. On Mac, DragData::numberOfFiles
949         checks the same UTIs as DragData::containsFiles (NSFilesPromisePboardType and NSFilenamesPboardType), but
950         additionally counts the number of file URLs corresponding to those UTIs.
951
952         On iOS, the implementation of numberOfFiles is new to iOS 11, and relevant only in the drag and drop flow.
953         Previously, we would consider an item provider to "contain" a file if it had a UTI conforming to one of the UTIs
954         acceptable for drag and drop (at the time of writing, these are ["public.content", "public.zip",
955         "public.folder"]). With this patch, anything conforming to these UTIs will continue to be represented as files,
956         but importantly, if an item provider indicates that it should be represented inline (i.e. a plain text
957         selection), then we don't consider that item provider as vending a file. This allows us to distinguish between
958         cases where we are dragging a plain text selection over a file input, and when we are dragging a plain text file.
959         In both cases, "public.plain-text" is offered as a registered UTI, but in the former, the item provider should
960         indicate that inline presentation style is preferred. Refer to <rdar://problem/32202542> for more details.
961
962 2017-09-12  Joseph Pecoraro  <pecoraro@apple.com>
963
964         QualifiedName::init should assume AtomicStrings::init was already called
965         https://bugs.webkit.org/show_bug.cgi?id=176639
966
967         Reviewed by Sam Weinig.
968
969         * dom/QualifiedName.cpp:
970         (WebCore::QualifiedName::init):
971         All callers of QualifiedName::init precede it with their own call to
972         AtomicString::init, so QualifiedName doesn't need to do it.
973
974 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
975
976         Unskip fast/text/system-font-synthetic-italic.html
977         https://bugs.webkit.org/show_bug.cgi?id=175944
978         <rdar://problem/32864306>
979
980         Reviewed by Jon Lee.
981
982         Our buildbots now all have this symbol.
983
984         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
985         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
986
987 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
988
989         ASSERTION FAILED: !m_valueOrException under FontFaceSet::completedLoading loading a Serious Eats page
990         https://bugs.webkit.org/show_bug.cgi?id=175899
991
992         Reviewed by Tim Horton.
993
994         Slight style update to r221835. Also adds a test.
995
996         Test: fast/text/document-fonts-while-loading-crash.html
997
998         * css/CSSFontFaceSet.h:
999         * css/FontFaceSet.cpp:
1000         (WebCore::FontFaceSet::FontFaceSet):
1001
1002 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
1003
1004         Inline ParserUtilities.h
1005         https://bugs.webkit.org/show_bug.cgi?id=176572
1006
1007         Reviewed by Darin Adler.
1008
1009         Its contents are only ever used from SVG files which also include SVGParserUtilities.h.
1010
1011         No new tests because there is no behavior change.
1012
1013         * WebCore.xcodeproj/project.pbxproj:
1014         * platform/text/ParserUtilities.h: Removed.
1015         * svg/SVGParserUtilities.h:
1016         (WebCore::skipString):
1017
1018 2017-09-12  Ryosuke Niwa  <rniwa@webkit.org>
1019
1020         Dragging & dropping a file creates an attachment element even when it's disabled
1021         https://bugs.webkit.org/show_bug.cgi?id=176769
1022
1023         Reviewed by Tim Horton.
1024
1025         The bug that dropping a file always created an attachment element even when it's disabled by settings
1026         was caused by WebContentReader::readFilenames always creating an attachment element. Fixed this by
1027         checking the runtime flag. The fix is tested by drag-files-to-editable-element-as-URLs.html
1028
1029         To fix the bug that HTMLAttachmentElement is always exposed on the global object even when it's disabled
1030         by settings, replaced the setting to enable attachment element by an equivalent runtime enabled flag,
1031         and hid both the interface as well as the element behind it. Fixed various bugs in our code generator
1032         to make this work.
1033
1034         Tests: editing/pasteboard/drag-files-to-editable-element-as-URLs.html
1035                editing/pasteboard/drag-files-to-editable-element-as-attachment.html
1036
1037         * bindings/js/WebCoreBuiltinNames.h: Added symbols used in the generated code.
1038         * dom/make_event_factory.pl:
1039         (defaultItemFactory): Replaced "runtimeConditonal" option by "runtimeEnabled".
1040         (generateImplementation):
1041         * dom/make_names.pl:
1042         (defaultTagPropertyHash):
1043         (printConstructorInterior): Return a HTMLUnknownElement if the element is disabled by a runtime flag.
1044         (printTypeHelpers): Make is<HTMLAttachmentElement>(~) returns false when the feature is disabled by
1045         checking whether the given element is an instance of HTMLUnknownElement.
1046         (printWrapperFunctions): Simplified this code by matching the code for settingsConditional.
1047         * editing/mac/EditorMac.mm:
1048         (WebCore::Editor::WebContentReader::readFilenames): Fixed the bug that this code was always creating
1049         an attachment element even when the feature is disabled.
1050         * html/HTMLAttachmentElement.idl: Hide this behind a runtime flag.
1051         * html/HTMLTagNames.in: 
1052         * page/RuntimeEnabledFeatures.h:
1053         (WebCore::RuntimeEnabledFeatures::setAttachmentElementEnabled): Added.
1054         (WebCore::RuntimeEnabledFeatures::attachmentElementEnabled const): Added.
1055         * page/Settings.in: Removed attachmentElementEnabled.
1056
1057 2017-09-12  Youenn Fablet  <youenn@apple.com>
1058
1059         Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
1060         https://bugs.webkit.org/show_bug.cgi?id=176579
1061
1062         Reviewed by Alex Christensen.
1063
1064         No change of behavior.
1065
1066         Introducing another version of queryCacheMatch used for the NetworkProcess implementation of the Cache.
1067         Exporting the copy of a response body to be used also there.
1068
1069         * Modules/cache/DOMCacheEngine.cpp:
1070         (WebCore::DOMCacheEngine::matchURLs):
1071         (WebCore::DOMCacheEngine::queryCacheMatch):
1072         (WebCore::DOMCacheEngine::copyResponseBody):
1073         * Modules/cache/DOMCacheEngine.h:
1074
1075 2017-09-12  Antti Koivisto  <antti@apple.com>
1076
1077         AnimationBase should point to Element instead of RenderElement
1078         https://bugs.webkit.org/show_bug.cgi?id=176807
1079
1080         Reviewed by Andreas Kling.
1081
1082         This is a step towards making animation system operate on elements and styles instead renderers.
1083
1084         No functional changes.
1085
1086         * page/animation/AnimationBase.cpp:
1087         (WebCore::AnimationBase::AnimationBase):
1088         (WebCore::AnimationBase::renderer const):
1089         (WebCore::AnimationBase::compositedRenderer const):
1090         (WebCore::AnimationBase::updateStateMachine):
1091         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
1092         (WebCore::AnimationBase::timeToNextService):
1093         (WebCore::AnimationBase::freezeAtTime):
1094         (WebCore::AnimationBase::getElapsedTime const):
1095         * page/animation/AnimationBase.h:
1096         (WebCore::AnimationBase::clear):
1097         (WebCore::AnimationBase::renderer const): Deleted.
1098         * page/animation/ImplicitAnimation.cpp:
1099         (WebCore::ImplicitAnimation::shouldSendEventForListener const):
1100         (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation const):
1101         (WebCore::ImplicitAnimation::startAnimation):
1102         (WebCore::ImplicitAnimation::pauseAnimation):
1103         (WebCore::ImplicitAnimation::endAnimation):
1104         (WebCore::ImplicitAnimation::sendTransitionEvent):
1105         (WebCore::ImplicitAnimation::reset):
1106         * page/animation/KeyframeAnimation.cpp:
1107         (WebCore::KeyframeAnimation::getAnimatedStyle):
1108         (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
1109         (WebCore::KeyframeAnimation::startAnimation):
1110         (WebCore::KeyframeAnimation::pauseAnimation):
1111         (WebCore::KeyframeAnimation::endAnimation):
1112         (WebCore::KeyframeAnimation::shouldSendEventForListener const):
1113         (WebCore::KeyframeAnimation::sendAnimationEvent):
1114         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
1115
1116 2017-09-12  Per Arne Vollan  <pvollan@apple.com>
1117
1118         [Win] Add Modules/fetch to list of forwarding headers folders.
1119         https://bugs.webkit.org/show_bug.cgi?id=176747
1120
1121         Reviewed by Brent Fulgham.
1122
1123         * PlatformWin.cmake:
1124
1125 2017-09-12  Jer Noble  <jer.noble@apple.com>
1126
1127         [MSE] Don't increase the reported totalFrameDelay for non-displayed frames (or frames coming in while paused).
1128         https://bugs.webkit.org/show_bug.cgi?id=175900
1129
1130         Reviewed by Eric Carlson.
1131
1132         When seeking to a specific time, the decompression session necessarily needs to be fed samples from before that
1133         time (i.e., all samples from the previous I-frame forward). These shouldn't contribute to the "total frame
1134         delay" metric. Neither should samples delivered when the video is paused (like, during seeking), as a frame can't
1135         be "late" if time is not moving forward.
1136
1137         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1138         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
1139         * platform/cf/CoreMediaSoftLink.cpp:
1140         * platform/cf/CoreMediaSoftLink.h:
1141
1142 2017-09-12  Sam Weinig  <sam@webkit.org>
1143
1144         Gtk build fix for "Finish off the FormData implementation" - https://bugs.webkit.org/show_bug.cgi?id=176659
1145
1146         * fileapi/Blob.cpp:
1147         (WebCore::Blob::Blob):
1148         * fileapi/Blob.h:
1149         * fileapi/File.cpp:
1150         (WebCore::File::File):
1151         
1152             Replace copy constructor with a tagged constructor.
1153
1154 2017-09-12  Dean Jackson  <dino@apple.com>
1155
1156         [WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
1157         https://bugs.webkit.org/show_bug.cgi?id=176771
1158         <rdar://problem/34386621>
1159
1160         Reviewed by Antoine Quint.
1161
1162         The OpenGL context in VideoTextureCopierCV wasn't being restored to
1163         the state it had before rendering a video to a texture. Specifically
1164         the vertex attribute values were never recorded by the state saver.
1165
1166         Update the existing test of VideoTextureCopierCV so that it is
1167         explicitly doing something different from the WebCore code, which
1168         means that state will have to be correctly restored for the test
1169         to pass.
1170
1171         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1172         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Make sure
1173         to record the vertex attribute state once we know the location of the position attribute.
1174         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
1175         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
1176         (WebCore::VideoTextureCopierCV::GC3DStateSaver::saveVertexAttribState): Save all the
1177         applicable vertex attribute state information.
1178         * platform/graphics/cv/VideoTextureCopierCV.h: GC3DStateSaver can use a reference
1179         to the GC3D rather than a pointer.
1180
1181 2017-09-12  Dean Jackson  <dino@apple.com>
1182
1183         [WebGL] accelerated texImage2D for video doesn't respect flipY
1184         https://bugs.webkit.org/show_bug.cgi?id=176491
1185         <rdar://problem/33833511>
1186
1187         Reviewed by Jer Noble.
1188
1189         (Take 2 - this was rolled out due to a test failure, but the following
1190         commit will fix that)
1191
1192         Previously, if UNPACK_FLIP_Y_WEBGL was set to true, we'd either fall
1193         back to software or fail to upload texture data. Fix this by intercepting
1194         the texImage2D call, checking the orientation of the video, and running
1195         a small shader program to flip it if necessary.
1196
1197         While there, implement UNPACK_PREMULTIPLY_ALPHA_WEBGL as well, although
1198         none of our media decoders support video with alpha, so unfortunately
1199         this will have no visible change.
1200
1201         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
1202                fast/canvas/webgl/texImage2D-video-flipY-true.html
1203
1204         * platform/cocoa/CoreVideoSoftLink.cpp: Add link to CVOpenGL(ES)TextureGetCleanTexCoords,
1205         which is used to check the orientation of the source video.
1206         * platform/cocoa/CoreVideoSoftLink.h:
1207
1208         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1209         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): We can
1210         now handle flipped or premultiplied requests.
1211         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1212         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): Ditto.
1213
1214         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1215         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): Rename readFramebuffer to
1216         simply framebuffer.
1217         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): Delete the program and buffer
1218         if they were created.
1219         (WebCore::VideoTextureCopierCV::initializeContextObjects): Sets up the shader program
1220         and the vertex buffer for drawing. Also records the location of the uniforms.
1221         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Create a new
1222         framebuffer object, and render the video texture into that framebuffer using a
1223         shader that can flip the coordinates.
1224         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): Helper to restore
1225         the state of the user's GraphicsContext3D while we're intercepting calls.
1226         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
1227         * platform/graphics/cv/VideoTextureCopierCV.h:
1228
1229         * platform/graphics/GraphicsContext3D.h: Add two new entry points, for direct shader
1230         compilation and attribute access. This avoids going through ANGLE.
1231         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1232         (WebCore::GraphicsContext3D::compileShader):
1233         (WebCore::GraphicsContext3D::compileShaderDirect):
1234         (WebCore::GraphicsContext3D::getAttribLocationDirect):
1235
1236 2017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
1237
1238         [css-grid] Stretching auto tracks should be done as part of the track sizing algorithm
1239         https://bugs.webkit.org/show_bug.cgi?id=176783
1240
1241         Reviewed by Sergio Villar Senin.
1242
1243         CSS WG has agreed to modify the track sizing algorithm to include
1244         a new step: https://drafts.csswg.org/css-grid/#algo-stretch
1245         We used to do the stretch of the "auto" tracks at the end of
1246         the track sizing algorithm, however this change integrates it
1247         into the algorithm itself as the last step.
1248         See: https://github.com/w3c/csswg-drafts/issues/1150
1249
1250         The patch moves the method
1251         RenderGrid::applyStretchAlignmentToTracksIfNeeded() to
1252         GridTrackSizingAlgorithm::stretchAutoTracks().
1253         And then modifies the grid track sizing algorithm to execute
1254         the new step.
1255
1256         This patch uses the WPT test updated to check the new behavior.
1257
1258         * rendering/GridTrackSizingAlgorithm.cpp:
1259         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): Initialize
1260         the list of auto tracks.
1261         (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks): Add
1262         early return if there are not flexible tracks.
1263         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks): Code moved from
1264         RenderGrid::applyStretchAlignmentToTracksIfNeeded().
1265         (WebCore::GridTrackSizingAlgorithm::setup): Reset list of auto tracks.
1266         (WebCore::GridTrackSizingAlgorithm::run): Add new step
1267         stretchAutoTracks().
1268         (WebCore::GridTrackSizingAlgorithm::reset): Reset auto tracks.
1269         * rendering/GridTrackSizingAlgorithm.h: Add m_autoSizedTracksIndex.
1270         * rendering/RenderGrid.cpp:
1271         (WebCore::RenderGrid::layoutBlock): Avoid applying stretch here.
1272         (WebCore::RenderGrid::contentAlignmentNormalBehaviorGrid): Make public.
1273         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Moved to
1274         GridTrackSizingAlgorithm::stretchAutoTracks().
1275         * rendering/RenderGrid.h:
1276
1277 2017-09-12  Eric Carlson  <eric.carlson@apple.com>
1278
1279         Switch MediaPlayerPrivateAVFoundation to release logging
1280         https://bugs.webkit.org/show_bug.cgi?id=176621
1281         <rdar://problem/34335311>
1282
1283         Reviewed by Jer Noble.
1284
1285         * html/HTMLMediaElement.h:
1286         * platform/graphics/MediaPlayer.cpp:
1287         (WebCore::nullLogger):
1288         (WebCore::MediaPlayer::mediaPlayerLogger):
1289         * platform/graphics/MediaPlayer.h:
1290         (WebCore::MediaPlayerClient::mediaPlayerLogIdentifier):
1291         (WebCore::MediaPlayerClient::mediaPlayerLogger):
1292         (WebCore::MediaPlayer::mediaPlayerLogIdentifier):
1293         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1294         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
1295         (WebCore::MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation):
1296         (WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
1297         (WebCore::MediaPlayerPrivateAVFoundation::tearDownVideoRendering):
1298         (WebCore::MediaPlayerPrivateAVFoundation::load):
1299         (WebCore::MediaPlayerPrivateAVFoundation::playabilityKnown):
1300         (WebCore::MediaPlayerPrivateAVFoundation::prepareToPlay):
1301         (WebCore::MediaPlayerPrivateAVFoundation::play):
1302         (WebCore::MediaPlayerPrivateAVFoundation::pause):
1303         (WebCore::MediaPlayerPrivateAVFoundation::durationMediaTime const):
1304         (WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance):
1305         (WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize):
1306         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const):
1307         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const):
1308         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
1309         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
1310         (WebCore::MediaPlayerPrivateAVFoundation::timeChanged):
1311         (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
1312         (WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration):
1313         (WebCore::MediaPlayerPrivateAVFoundation::setPreload):
1314         (WebCore::MediaPlayerPrivateAVFoundation::mainThreadCallback):
1315         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
1316         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
1317         (WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks):
1318         (WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
1319         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
1320         (WebCore::MediaPlayerPrivateAVFoundation::logClassName const):
1321         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1322         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1323         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
1324         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
1325         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
1326         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
1327         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator):
1328         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1329         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
1330         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1331         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
1332         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
1333         (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
1334         (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
1335         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const):
1336         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
1337         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
1338         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
1339         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
1340         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
1341         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
1342         (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus const):
1343         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator):
1344         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
1345         (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
1346         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
1347         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
1348         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
1349         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
1350         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput):
1351         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
1352         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
1353         (WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput):
1354         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyOpenGLVideoOutput):
1355         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
1356         (WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
1357         (WebCore::MediaPlayerPrivateAVFoundationObjC::flushCues):
1358         (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
1359         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const):
1360         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
1361         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
1362         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
1363         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
1364         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
1365         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
1366         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
1367         (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
1368         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1369         (WebCore::boolString): Deleted.
1370
1371 2017-09-12  Daniel Bates  <dabates@apple.com>
1372
1373         REGRESSION (r215784): The title of right-to-left pages are empty
1374         https://bugs.webkit.org/show_bug.cgi?id=176746
1375         <rdar://problem/34211419>
1376
1377         Reviewed by Brent Fulgham.
1378
1379         Left truncate a long right-to-left title.
1380
1381         Right-to-left text represents the visual ordering of text. Internally WebKit stores
1382         right-to-left text identically to left-to-right text in memory. So, we can use the
1383         same string operation to truncate right-to-left text as we do to truncate left-to-right
1384         text.
1385
1386         * platform/text/StringWithDirection.h:
1387         (WebCore::truncateFromEnd):
1388
1389 2017-09-12  Chris Fleizach  <cfleizach@apple.com>
1390
1391         AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
1392         https://bugs.webkit.org/show_bug.cgi?id=170475
1393         <rdar://problem/31439222>
1394
1395         Reviewed by Joanmarie Diggs.
1396
1397         Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html
1398
1399         * accessibility/AccessibilityNodeObject.cpp:
1400         (WebCore::AccessibilityNodeObject::helpText):
1401         (WebCore::AccessibilityNodeObject::accessibilityDescription):
1402         (WebCore::AccessibilityNodeObject::roleIgnoresTitle):
1403         * accessibility/AccessibilityNodeObject.h:
1404
1405 2017-09-12  Brent Fulgham  <bfulgham@apple.com>
1406
1407         Show punycode to user if a URL mixes Armenian Seh or Vo with other scripts
1408         https://bugs.webkit.org/show_bug.cgi?id=176578
1409         <rdar://problem/33906231>
1410
1411         Reviewed by Alex Christensen.
1412
1413         Revise our "lookalike character" logic to include the Armenian Vo and Seh
1414         characters, which can be mistaken for 'n' and 'v' when displayed in
1415         certain fonts.
1416
1417         Tested by new API tests.
1418
1419         * platform/mac/WebCoreNSURLExtras.mm:
1420         (WebCore::isArmenianLookalikeCharacter): Added utility function.
1421         (WebCore::isArmenianScriptCharacter): Ditto.
1422         (WebCore::isLookalikeCharacter): Handle Armenian-lookalike cases.
1423
1424 2017-09-12  Antti Koivisto  <antti@apple.com>
1425
1426         Remove RenderElement::isCSSAnimating boolean
1427         https://bugs.webkit.org/show_bug.cgi?id=176779
1428
1429         Reviewed by Andreas Kling.
1430
1431         This optimization can be replaced with a simple style test that doesn't require keeping
1432         two sources of truth in sync.
1433
1434         * page/animation/CSSAnimationController.cpp:
1435         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
1436         (WebCore::CSSAnimationControllerPrivate::clear):
1437
1438             Can't test here as style might have become non-animating and we don't clear animation when that happens.
1439             This is only called on renderer destruction so it is not an important optimization.
1440
1441         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
1442         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
1443         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer):
1444         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
1445         (WebCore::CSSAnimationController::cancelAnimations):
1446         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer):
1447         (WebCore::CSSAnimationController::computeExtentOfAnimation const):
1448         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
1449         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
1450
1451             Test if the style has any animations. This is roughly equivalent of the old test.
1452             (it is actually somewhat better as the boolean was never cleared on style changes)
1453
1454         * rendering/RenderElement.cpp:
1455         (WebCore::RenderElement::RenderElement):
1456         * rendering/RenderElement.h:
1457         (WebCore::RenderElement::isCSSAnimating const): Deleted.
1458         (WebCore::RenderElement::setIsCSSAnimating): Deleted.
1459         * rendering/style/RenderStyle.h:
1460         (WebCore::RenderStyle::hasAnimationsOrTransitions const):
1461
1462 2017-09-12  Ms2ger  <Ms2ger@igalia.com>
1463
1464         Disallow passing null data to uniform1uiv() and friends.
1465         https://bugs.webkit.org/show_bug.cgi?id=176777
1466
1467         Reviewed by Sam Weinig.
1468
1469         This matches the specification as well as Gecko and Chromium.
1470
1471         Test: fast/canvas/webgl/webgl2/bindings.html
1472
1473         * html/canvas/WebGL2RenderingContext.idl:
1474
1475 2017-09-12  Sam Weinig  <sam@webkit.org>
1476
1477         [Cleanup] Follow up cleanup for DOMFormData implementation
1478         https://bugs.webkit.org/show_bug.cgi?id=176740
1479
1480         Reviewed by Alex Christensen.
1481
1482         - Merges FormDataList into DOMFormData.
1483         - Streamline / refactor FormData creation from DOMFormData.
1484
1485         * CMakeLists.txt:
1486         * WebCore.xcodeproj/project.pbxproj:
1487         * html/FormDataList.cpp: Removed.
1488         * html/FormDataList.h: Removed.
1489
1490             Remove FormDataList.
1491
1492         * html/DOMFormData.cpp:
1493         (WebCore::DOMFormData::DOMFormData):
1494         (WebCore::DOMFormData::createFileEntry):
1495         (WebCore::DOMFormData::append):
1496         (WebCore::DOMFormData::set):
1497         (WebCore::DOMFormData::Iterator::next):
1498         * html/DOMFormData.h:
1499         (WebCore::DOMFormData::items const):
1500         (WebCore::DOMFormData::encoding const):
1501
1502             Merge FormDataList into DOMFormData. FormDataList's additional
1503             appendData/appendBlob functions have been removed, and their
1504             functionality inlined into DOMFormData's append functions. 
1505
1506             Adopted makeKeyValuePair in DOMFormData::Iterator::next().
1507
1508         * platform/network/FormData.cpp:
1509         (WebCore::FormData::create):
1510         (WebCore::FormData::createMultiPart):
1511         (WebCore::normalizeStringData):
1512         (WebCore::FormData::appendMultiPartFileValue):
1513         (WebCore::FormData::appendMultiPartStringValue):
1514         (WebCore::FormData::appendMultiPartKeyValuePairItems):
1515         (WebCore::FormData::appendNonMultiPartKeyValuePairItems):
1516         (WebCore::FormData::appendKeyValuePairItems): Deleted.
1517         * platform/network/FormData.h:
1518
1519             Split-up appendKeyValuePairItems into separate multipart and non-multipart
1520             functions, as the two edges of the branch didn't share much in common. Further
1521             split out multipart file and multipart string appending, since they too did not
1522             share that much in common and makes the code easier to follow. 
1523
1524             String value normalization has been moved entirely here (previously it was a member 
1525             function of FormDataList) as FormData is the only user.
1526
1527         * xml/XMLHttpRequest.cpp:
1528         (WebCore::XMLHttpRequest::send):
1529         * loader/FormSubmission.cpp:
1530         (WebCore::FormSubmission::create):
1531         * Modules/fetch/FetchBody.cpp:
1532         (WebCore::FetchBody::extract):
1533         
1534             Update for new FormData create functions which don't need the
1535             encoding passed explicitly, since it is part of the DOMFormData.
1536         
1537         * html/BaseButtonInputType.cpp:
1538         * html/BaseButtonInputType.h:
1539         * html/BaseCheckableInputType.cpp:
1540         * html/BaseCheckableInputType.h:
1541         * html/FileInputType.cpp:
1542         * html/FileInputType.h:
1543         * html/FormAssociatedElement.h:
1544         * html/HTMLButtonElement.cpp:
1545         * html/HTMLButtonElement.h:
1546         * html/HTMLFormControlElement.h:
1547         * html/HTMLInputElement.cpp:
1548         * html/HTMLInputElement.h:
1549         * html/HTMLKeygenElement.cpp:
1550         * html/HTMLKeygenElement.h:
1551         * html/HTMLMeterElement.cpp:
1552         * html/HTMLObjectElement.cpp:
1553         * html/HTMLObjectElement.h:
1554         * html/HTMLSelectElement.cpp:
1555         * html/HTMLSelectElement.h:
1556         * html/HTMLTextAreaElement.cpp:
1557         * html/HTMLTextAreaElement.h:
1558         * html/HiddenInputType.cpp:
1559         * html/HiddenInputType.h:
1560         * html/ImageInputType.cpp:
1561         * html/ImageInputType.h:
1562         * html/InputType.cpp:
1563         * html/InputType.h:
1564         * html/SubmitInputType.cpp:
1565         * html/SubmitInputType.h:
1566         * html/TextFieldInputType.cpp:
1567         * html/TextFieldInputType.h:
1568
1569             Update to use DOMFormData directly, rather than the FormDataList, which 
1570             has been removed.
1571
1572         * page/csp/ContentSecurityPolicy.cpp:
1573
1574             Remove unnecessary #include of unused (and now removed) FormDataList.h
1575
1576 2017-09-12  Zan Dobersek  <zdobersek@igalia.com>
1577
1578         [EME] Implement CDMInstanceClearKey::requestLicense()
1579         https://bugs.webkit.org/show_bug.cgi?id=176773
1580
1581         Reviewed by Xabier Rodriguez-Calvar.
1582
1583         Implement the requestLicense() method for CDMInstanceClearKey. Per
1584         the specification, the session ID must be a 32-bit numerical value.
1585         A session ID value counter is thus kept in a static uint32_ object
1586         and incremented upon each call of requestLicense(). Init data and
1587         the session ID value are then embedded in the asynchronous dispatch
1588         that invokes the callback. That invocation now also passes along the
1589         init data, the session ID in string format, and Succeeded to now
1590         indicate the operation was completed successfully.
1591
1592         No new tests -- expectations for the relevant tests are updated
1593         to reflect the introduced changes.
1594
1595         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1596         (WebCore::CDMInstanceClearKey::requestLicense):
1597
1598 2017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
1599
1600         [css-grid] Use transferred size over content size for automatic minimum size
1601         https://bugs.webkit.org/show_bug.cgi?id=176688
1602
1603         Reviewed by Sergio Villar Senin.
1604
1605         CSS WG has agreed to modify the spec so now the transferred size is used
1606         (if it exists) independently if it's bigger or smaller
1607         than the content size.
1608         See: https://github.com/w3c/csswg-drafts/issues/1149
1609
1610         The spec text (https://drafts.csswg.org/css-grid/#min-size-auto):
1611           "The automatic minimum size for a grid item in a given dimension is
1612            its specified size if it exists, otherwise its transferred size
1613            if that exists, else its content size"
1614
1615         This patch use the WPT tests updated to check the new behavior.
1616
1617         * rendering/GridTrackSizingAlgorithm.cpp:
1618         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
1619         Modified so it always returns the transferred size (if any).
1620
1621 2017-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
1622
1623         [Freetype] Doesn't support coloured fonts
1624         https://bugs.webkit.org/show_bug.cgi?id=156579
1625
1626         Reviewed by Michael Catanzaro.
1627
1628         Covered by existing tests. This needs a large rebaseline that will be done in follow up commits.
1629
1630         * platform/graphics/FontCascade.h: Enable advance text rendering mode by default.
1631         (WebCore::FontCascade::advancedTextRenderingMode const):
1632         (WebCore::FontCascade::computeRequiresShaping const):
1633         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1634         (WebCore::Font::platformInit): Do not get metrics from OS/2 table for non-scalable fonts.
1635         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
1636         (WebCore::harfBuzzGetGlyph): Use U8_APPEND_UNSAFE() instead of converting to a String and then encoding it with
1637         UTF8Encoding().
1638
1639 2017-09-12  Frederic Wang  <fwang@igalia.com>
1640
1641         Remove unnecessary virtual keyword from JS test files
1642         https://bugs.webkit.org/show_bug.cgi?id=176683
1643
1644         Reviewed by Simon Fraser.
1645
1646         JS bindings headers do not comply with the WebKit coding style since they use both the
1647         "virtual" and "override" keywords. This patch modifies the generator script to only use
1648         "override" and regenerates the bindings accordingly.
1649
1650         No new tests, behavior unchanged.
1651
1652         * bindings/scripts/CodeGeneratorJS.pm:
1653         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
1654         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h:
1655         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h:
1656         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
1657         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
1658         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
1659
1660 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1661
1662         [iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
1663         https://bugs.webkit.org/show_bug.cgi?id=176721
1664         <rdar://problem/34373660>
1665
1666         Reviewed by Tim Horton.
1667
1668         Adds support for setting the drag lift preview frame in the case where DataTransfer.setDragImage is being used
1669         to override the default drag preview. Currently, the frame of the drag preview we supply in this case is the
1670         same as the bounds of the source element in root view coordinates, but this means that any custom drag image
1671         the page supplies will be stretched to fill the frame of the source element. Instead, when handling a DHTML drag,
1672         position the lift and cancel drag previews relative to the event location, respecting any drag offset specified
1673         in setDragImage. The size of this preview matches the size of the drag image source (since this is all in root
1674         view coordinates, this means the drag preview will also enlarge if the user pinches to zoom in). If a
1675         disconnected image source element was provided, then we just fall back to the image size.
1676
1677         Additionally, renames DragItem's elementBounds to dragPreviewFrameInRootViewCoordinates to better reflect the
1678         purpose of this variable. This patch also introduces API test plumbing to grab targeted drag previews from the
1679         drag interaction delegate (i.e. WKContentView), and uses this in a new API test that checks the frame of the
1680         resulting UITargetedDragPreview after initiating a drag in various circumstances (see changes in Tools/ for more
1681         detail).
1682
1683         Test: DataInteractionTests.DragLiftPreviewDataTransferSetDragImage
1684
1685         * dom/DataTransfer.cpp:
1686         (WebCore::DataTransfer::dragImageElement const):
1687         * dom/DataTransfer.h:
1688         * page/DragController.cpp:
1689         (WebCore::dragLocForDHTMLDrag):
1690
1691         The logic to flip the y offset when computing the drag location is only relevant on Mac, but currently, this is
1692         guarded by #if PLATFORM(COCOA), which causes the y offset to shift the drag image in the opposite direction on
1693         iOS. To fix this, simply change the platform define to Mac.
1694
1695         (WebCore::DragController::doSystemDrag):
1696         * platform/DragItem.h:
1697         (WebCore::DragItem::encode const):
1698         (WebCore::DragItem::decode):
1699
1700 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1701
1702         [iOS WK2] Support tapping to add items to the current drag session in web content
1703         https://bugs.webkit.org/show_bug.cgi?id=176421
1704         <rdar://problem/31144674>
1705
1706         Reviewed by Tim Horton.
1707
1708         Refactors some drag initiation logic to handle starting a drag when data has already been written to the
1709         pasteboard (in the case of iOS, WebItemProviderPasteboard). See annotated comments below for more detail.
1710
1711         Tests: DataInteractionTests.AdditionalLinkAndImageIntoContentEditable
1712
1713         * page/DragActions.h:
1714         * page/DragController.cpp:
1715         (WebCore::DragController::startDrag):
1716
1717         Add a HasNonDefaultPasteboardData argument here, and replace checks for !dataTransfer.pasteboard().hasData()
1718         with checks for whether the argument is HasNonDefaultPasteboardData::No. These checks for Pasteboard::hasData()
1719         currently prevent us from overwriting custom pasteboard data, in the case that the page has written pasteboard
1720         data using the event's DataTransfer. However, in the case of adding additional drag items to the session, we
1721         will already have pasteboard data, so these checks will prevent us from writing default data to the pasteboard.
1722         See EventHandler::handleDrag for more detail.
1723
1724         * page/DragController.h:
1725         * page/DragState.h:
1726
1727         Remove the draggedContentRange member from DragState. See below.
1728
1729         * page/EventHandler.cpp:
1730         (WebCore::removeDraggedContentDocumentMarkersFromAllFramesInPage):
1731
1732         Simplify the handling of dragged content range markers. Instead of storing the DOM Range being dragged and
1733         removing/repainting the range after dragging ends, just repaint the contentRenderer of the frame being dragged.
1734         When the dragging session has completely ended, remove all dragged content ranges from the page's mainframe and
1735         all of its subframes, and repaint everything.
1736
1737         (WebCore::EventHandler::dragCancelled):
1738         (WebCore::EventHandler::didStartDrag):
1739         (WebCore::EventHandler::dragSourceEndedAt):
1740
1741         Add a MayExtendDragSession argument, indicating whether or not the web process will attempt to continue the drag
1742         session, in which case EventHandler::dragSourceEndedAt should not remove any existing dragged content range
1743         document markers.
1744
1745         (WebCore::EventHandler::dispatchDragStartEvent):
1746
1747         Helper method to dispatch a `dragstart` event, return whether or not to proceed with the drag, and also compute
1748         (as an outparam) whether or not custom pasteboard data was written during the event.
1749
1750         (WebCore::EventHandler::handleDrag):
1751
1752         If custom data was written during `dragstart`, pass along HasNonDefaultPasteboardData::Yes when calling
1753         DragController::startDrag.
1754
1755         (WebCore::repaintContentsOfRange): Deleted.
1756         * page/EventHandler.h:
1757         * page/ios/EventHandlerIOS.mm:
1758         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
1759         * platform/Pasteboard.h:
1760         * platform/ios/PasteboardIOS.mm:
1761         (WebCore::Pasteboard::changeCount const):
1762         * platform/ios/WebItemProviderPasteboard.mm:
1763         (-[WebItemProviderPasteboard setItemProviders:]):
1764
1765         Stop clearing out the staged item provider registration list when setting item providers. After refactoring in
1766         r221595, staged registration lists are now automatically cleared out when (1) the drag-and-drop interaction
1767         state is cleared out in the UI process, or (2) when the registration list is taken by WKContentView (see
1768         -takeRegistrationList) when generating an item provider.
1769
1770         * platform/mac/PasteboardMac.mm:
1771         (WebCore::Pasteboard::changeCount const):
1772
1773         Add a changeCount method to Pasteboard on Cocoa platforms (Mac, iOS) which support changeCount natively. In
1774         theory, there's no reason Windows, GTK and WPE ports can't also implement a similar mechanism in
1775         PlatformPasteboard, but this isn't needed for anything yet. Upon dragstart, it is safe to assume that the
1776         pasteboard has been cleared on these platforms, so checking for Pasteboard::hasData (as we do for all platforms
1777         currently) is sufficient.
1778
1779 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
1780
1781         Unreviewed, rolling out r221762.
1782
1783         This change caused flakiness in a webgl LayoutTest.
1784
1785         Reverted changeset:
1786
1787         "[WebGL] accelerated texImage2D for video doesn't respect
1788         flipY"
1789         https://bugs.webkit.org/show_bug.cgi?id=176491
1790         http://trac.webkit.org/changeset/221762
1791
1792 2017-09-11  Per Arne Vollan  <pvollan@apple.com>
1793
1794         [Win] Add Modules/cache to list of forwarding headers folders.
1795         https://bugs.webkit.org/show_bug.cgi?id=176737
1796
1797         Reviewed by Alex Christensen.
1798
1799         * PlatformWin.cmake:
1800
1801 2017-09-11  Joanmarie Diggs  <jdiggs@igalia.com>
1802
1803         AX: [ATK] aria-autocomplete not exposed on comboboxes
1804         https://bugs.webkit.org/show_bug.cgi?id=176724
1805
1806         Reviewed by Chris Fleizach.
1807
1808         Add a check to AccessibilityObject::supportsARIAAutoComplete() for
1809         combobox because isARIATextControl() returns false for that role.
1810
1811         Add new combobox test cases to existing aria-autocomplete.html test.
1812
1813         * accessibility/AccessibilityObject.cpp:
1814         (WebCore::AccessibilityObject::supportsARIAAutoComplete const):
1815
1816 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
1817
1818         Unreviewed, rolling out r221854.
1819
1820         The test added with this change fails on 32-bit JSC bots.
1821
1822         Reverted changeset:
1823
1824         "[DFG] Optimize WeakMap::get by adding intrinsic and fixup"
1825         https://bugs.webkit.org/show_bug.cgi?id=176010
1826         http://trac.webkit.org/changeset/221854
1827
1828 2017-09-11  Dean Jackson  <dino@apple.com>
1829
1830         [WebGL macOS] No need to multisample when blitting into WebGLLayer
1831         https://bugs.webkit.org/show_bug.cgi?id=176666
1832         <rdar://problem/27774626>
1833
1834         Reviewed by Sam Weinig.
1835
1836         We were seeing performance profiles suggesting WebGL was
1837         doing 8x MSAA, even though we explicitly set it to only
1838         use 4 samples in the GLPixelFormatObj used to create
1839         the WebGL CGLContextObj. However, that same CGLPixelFormatObj
1840         was also used for the WebGLLayer's CGLContextObj, meaning the
1841         blit of the WebGL FBO into the WebGLLayer's backing store was
1842         multisampling as well -- so an extra 4 samples on top of the
1843         original 4, making it look like we were doing 8x.
1844
1845         This was obviously unnecessary, since we already have the
1846         multisampled FBO and just want to copy it, as is, into the layer.
1847
1848         Now, instead of copying the CGLPixelFormatObj, we create
1849         a new one and copy most of the attributes, leaving out
1850         the multisample flags (and the depth buffer, since we're
1851         only doing 2d blits).
1852
1853         Covered by existing WebGL tests, since there should be no
1854         visible change.
1855
1856         * platform/graphics/cocoa/WebGLLayer.mm:
1857         (-[WebGLLayer copyCGLPixelFormatForDisplayMask:]): Create a new
1858         CGLPixelFormatObj that copies most of the values from
1859         the corresponding object on the WebGL's backing CGLContextObj.
1860
1861 2017-09-11  Zan Dobersek  <zdobersek@igalia.com>
1862
1863         [EME] ClearKey: implement CDMInstanceClearKey state modifiers, callback dispatches
1864         https://bugs.webkit.org/show_bug.cgi?id=176687
1865
1866         Reviewed by Xabier Rodriguez-Calvar.
1867
1868         Implement the state modification methods on the CDMInstanceClearKey class.
1869         Initialization method is a no-op, but returns Succeeded. Distinctive
1870         identifier and persistent state setters return Succeeded if the passed-in
1871         value is false. setServerCertificate() still returns Failed due to server
1872         certificates not being supported in this ClearKey implementation.
1873
1874         The license and session operation methods are also implemented, but for
1875         now the implementations simply schedule a main thread dispatch that
1876         invokes the callback with failure-indicating values. This avoids various
1877         tests timing out, instead preferring that the tests for now fail with an
1878         exception (in most cases NotSupportedError).
1879
1880         No new tests -- relevant tests have baselines updated.
1881
1882         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1883         (WebCore::CDMInstanceClearKey::CDMInstanceClearKey):
1884         (WebCore::CDMInstanceClearKey::initializeWithConfiguration):
1885         (WebCore::CDMInstanceClearKey::setDistinctiveIdentifiersAllowed):
1886         (WebCore::CDMInstanceClearKey::setPersistentStateAllowed):
1887         (WebCore::CDMInstanceClearKey::setServerCertificate):
1888         (WebCore::CDMInstanceClearKey::requestLicense):
1889         (WebCore::CDMInstanceClearKey::updateLicense):
1890         (WebCore::CDMInstanceClearKey::loadSession):
1891         (WebCore::CDMInstanceClearKey::closeSession):
1892         (WebCore::CDMInstanceClearKey::removeSessionData):
1893         * platform/encryptedmedia/clearkey/CDMClearKey.h:
1894
1895 2017-09-11  Alex Christensen  <achristensen@webkit.org>
1896
1897         Modernize BoxExtent into RectEdges
1898         https://bugs.webkit.org/show_bug.cgi?id=176437
1899
1900         Reviewed by Simon Fraser.
1901
1902         And give it its own header.
1903         No change in behavior.
1904
1905         * WebCore.xcodeproj/project.pbxproj:
1906         * css/CSSProperty.cpp:
1907         (WebCore::resolveToPhysicalProperty):
1908         (WebCore::CSSProperty::resolveDirectionAwareProperty):
1909         * platform/LengthBox.h:
1910         (WebCore::LengthBox::LengthBox):
1911         (WebCore::BoxExtent::BoxExtent): Deleted.
1912         (WebCore::BoxExtent::at): Deleted.
1913         (WebCore::BoxExtent::top): Deleted.
1914         (WebCore::BoxExtent::right): Deleted.
1915         (WebCore::BoxExtent::bottom): Deleted.
1916         (WebCore::BoxExtent::left): Deleted.
1917         (WebCore::BoxExtent::at const): Deleted.
1918         (WebCore::BoxExtent::top const): Deleted.
1919         (WebCore::BoxExtent::right const): Deleted.
1920         (WebCore::BoxExtent::bottom const): Deleted.
1921         (WebCore::BoxExtent::left const): Deleted.
1922         (WebCore::BoxExtent::setAt): Deleted.
1923         (WebCore::BoxExtent::setTop): Deleted.
1924         (WebCore::BoxExtent::setRight): Deleted.
1925         (WebCore::BoxExtent::setBottom): Deleted.
1926         (WebCore::BoxExtent::setLeft): Deleted.
1927         (WebCore::BoxExtent::before): Deleted.
1928         (WebCore::BoxExtent::after): Deleted.
1929         (WebCore::BoxExtent::start): Deleted.
1930         (WebCore::BoxExtent::end): Deleted.
1931         (WebCore::BoxExtent::before const): Deleted.
1932         (WebCore::BoxExtent::after const): Deleted.
1933         (WebCore::BoxExtent::start const): Deleted.
1934         (WebCore::BoxExtent::end const): Deleted.
1935         (WebCore::BoxExtent::setBefore): Deleted.
1936         (WebCore::BoxExtent::setAfter): Deleted.
1937         (WebCore::BoxExtent::setStart): Deleted.
1938         (WebCore::BoxExtent::setEnd): Deleted.
1939         (WebCore::BoxExtent::operator== const): Deleted.
1940         (WebCore::BoxExtent::operator!= const): Deleted.
1941         * platform/RectEdges.h: Added.
1942         (WebCore::RectEdges::RectEdges):
1943         (WebCore::RectEdges::at):
1944         (WebCore::RectEdges::top):
1945         (WebCore::RectEdges::right):
1946         (WebCore::RectEdges::bottom):
1947         (WebCore::RectEdges::left):
1948         (WebCore::RectEdges::at const):
1949         (WebCore::RectEdges::top const):
1950         (WebCore::RectEdges::right const):
1951         (WebCore::RectEdges::bottom const):
1952         (WebCore::RectEdges::left const):
1953         (WebCore::RectEdges::setAt):
1954         (WebCore::RectEdges::setTop):
1955         (WebCore::RectEdges::setRight):
1956         (WebCore::RectEdges::setBottom):
1957         (WebCore::RectEdges::setLeft):
1958         (WebCore::RectEdges::before):
1959         (WebCore::RectEdges::after):
1960         (WebCore::RectEdges::start):
1961         (WebCore::RectEdges::end):
1962         (WebCore::RectEdges::before const):
1963         (WebCore::RectEdges::after const):
1964         (WebCore::RectEdges::start const):
1965         (WebCore::RectEdges::end const):
1966         (WebCore::RectEdges::setBefore):
1967         (WebCore::RectEdges::setAfter):
1968         (WebCore::RectEdges::setStart):
1969         (WebCore::RectEdges::setEnd):
1970         (WebCore::RectEdges::operator== const):
1971         (WebCore::RectEdges::operator!= const):
1972         * platform/graphics/ca/TileController.cpp:
1973         (WebCore::TileController::setHasMargins):
1974         * platform/graphics/ca/TileController.h:
1975         * platform/text/WritingMode.h:
1976         (WebCore::isHorizontalPhysicalSide):
1977         * rendering/style/NinePieceImage.cpp:
1978         (WebCore::NinePieceImage::isEmptyPieceRect):
1979         * rendering/style/NinePieceImage.h:
1980         (WebCore::imagePieceHorizontalSide):
1981         (WebCore::imagePieceVerticalSide):
1982         * rendering/style/RenderStyle.cpp:
1983         (WebCore::RenderStyle::getShadowInsetExtent const):
1984
1985 2017-09-11  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1986
1987         [WinCairo] Fix the wincairo build after r221839
1988         https://bugs.webkit.org/show_bug.cgi?id=176681
1989
1990         Reviewed by Per Arne Vollan.
1991
1992         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1993         (WebCore::ResourceHandleCurlDelegate::setupPOST):
1994
1995 2017-09-11  Andy Estes  <aestes@apple.com>
1996
1997         [Mac] Upstream QTKit-related WebKitSystemInterface functions
1998         https://bugs.webkit.org/show_bug.cgi?id=176472
1999
2000         Reviewed by Eric Carlson.
2001
2002         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2003         (WebCore::disableComponentsOnce):
2004         (WebCore::MediaPlayerPrivateQTKit::createQTMovie):
2005         (WebCore::MediaPlayerPrivateQTKit::hasClosedCaptions const):
2006         (WebCore::MediaPlayerPrivateQTKit::setClosedCaptionsVisible):
2007         (WebCore::selectPreferredAlternateTrackForMediaType):
2008         (WebCore::selectPreferredAlternates):
2009         (WebCore::MediaPlayerPrivateQTKit::updateStates):
2010         (WebCore::mimeModernTypesCache):
2011         (WebCore::MediaPlayerPrivateQTKit::originsInMediaCache):
2012         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
2013         (WebCore::MediaPlayerPrivateQTKit::clearMediaCacheForOrigins):
2014         (WebCore::MediaPlayerPrivateQTKit::hasSingleSecurityOrigin const):
2015         (WebCore::MediaPlayerPrivateQTKit::movieLoadType const):
2016         (WebCore::MediaPlayerPrivateQTKit::canSaveMediaData const):
2017         * platform/mac/WebCoreSystemInterface.h:
2018         * platform/mac/WebCoreSystemInterface.mm:
2019         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2020         (createMediaUIControl):
2021         (createControlWithMediaUIControlType):
2022         (createMediaUIBackgroundView):
2023         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
2024
2025 2017-09-08  Andy Estes  <aestes@apple.com>
2026
2027         Try to fix the Internal El Capitan build after r221773.
2028
2029         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2030         (WebCore::mimeModernTypesCache):
2031
2032 2017-09-11  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2033
2034         [WPE] Bump freetype version to 2.8.0
2035         https://bugs.webkit.org/show_bug.cgi?id=176501
2036
2037         Reviewed by Michael Catanzaro.
2038
2039         Enable back the changes done by r221670 that were disabled for WPE on r221719.
2040
2041         Covered by existing tests.
2042
2043         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
2044         (WebCore::scaledFontWithoutMetricsHinting):
2045         (WebCore::Font::platformInit):
2046
2047 2017-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2048
2049         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
2050         https://bugs.webkit.org/show_bug.cgi?id=176010
2051
2052         Reviewed by Filip Pizlo.
2053
2054         * platform/network/curl/CurlJobManager.cpp:
2055         (WebCore::CurlJobList::finishJobs):
2056
2057 2017-09-10  Zan Dobersek  <zdobersek@igalia.com>
2058
2059         [GStreamer] Drop libgcrypt initialization in webkit_media_clear_key_decrypt_init()
2060         https://bugs.webkit.org/show_bug.cgi?id=176656
2061
2062         Reviewed by Michael Catanzaro.
2063
2064         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2065         (webkit_media_clear_key_decrypt_init): Don't re-initialize libgcrypt here
2066         since that's already done in the WebProcess main(), and the calls here
2067         only result in libgcrypt writing out 'Oops' warnings on stderr.
2068
2069 2017-09-10  Mark Lam  <mark.lam@apple.com>
2070
2071         Fix all ExceptionScope verification failures in JavaScriptCore.
2072         https://bugs.webkit.org/show_bug.cgi?id=176662
2073         <rdar://problem/34352085>
2074
2075         Reviewed by Filip Pizlo.
2076
2077         No new tests because this is covered by existing tests with the JSC_validateExceptionChecks=true enabled.
2078
2079         * bindings/js/JSCustomElementInterface.cpp:
2080         (WebCore::JSCustomElementInterface::tryToConstructCustomElement):
2081         * bindings/js/JSCustomElementRegistryCustom.cpp:
2082         (WebCore::whenDefinedPromise):
2083         * bindings/js/JSDOMConvertRecord.h:
2084         * bindings/js/JSDOMMapLike.cpp:
2085         (WebCore::createBackingMap):
2086         * bindings/js/JSDOMPromiseDeferred.cpp:
2087         (WebCore::DeferredPromise::callFunction):
2088         (WebCore::DeferredPromise::reject):
2089         * bindings/js/JSDOMPromiseDeferred.h:
2090         (WebCore::callPromiseFunction):
2091
2092 2017-09-10  Frederic Wang  <fwang@igalia.coml>
2093
2094         Make RenderLayerCompositor always use isRootLayer()
2095         https://bugs.webkit.org/show_bug.cgi?id=176591
2096
2097         Reviewed by Darin Adler.
2098
2099         RenderLayerCompositor contains a few comparisons of the form &layer == m_renderView.layer().
2100         This patch replaces them with "layer.isRootLayer()" which simply verifies that "layer" is
2101         associated to the one (and only one) RenderView of the RenderLayerCompositor. It makes things
2102         more readable and more consistent with the rest of the file.
2103
2104         No new tests, behavior unchanged.
2105
2106         * rendering/RenderLayerCompositor.cpp:
2107         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
2108         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
2109         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2110
2111 2017-09-09  Sam Weinig  <sam@webkit.org>
2112
2113         Finish off the FormData implementation
2114         https://bugs.webkit.org/show_bug.cgi?id=176659
2115
2116         Reviewed by Darin Adler.
2117
2118         * fileapi/Blob.cpp:
2119         * fileapi/Blob.h:
2120         * fileapi/File.cpp:
2121         * fileapi/File.h:
2122
2123             Add constructors / create functions for making File objects
2124             from an existing Blob or File with an override name.
2125
2126         * html/DOMFormData.cpp:
2127         * html/DOMFormData.h:
2128
2129             Add missing operations and iterator implementation
2130             and bring append up to spec by no ignoring empty names.
2131
2132         * html/DOMFormData.idl:
2133
2134             Bring IDL up to spec. Leave its exposure to just the window for
2135             now, as FormData currently depends on the Document/Page for replace
2136             file generation and therefore cannot operate in a worker.
2137
2138         * html/FormDataList.cpp:
2139         * html/FormDataList.h:
2140
2141             Changes FormDataList::Item to a String key and Variant<RefPtr<File>, String>
2142             data, matching spec concepts more cleanly. Normalization / encoding has also
2143             been made lazy, and now does not happen until creating a FormData from the
2144             FormDataList.
2145
2146             Since we now store Files, rather than Blobs, we follow the spec's 'create an 
2147             entry' algorithm to convert Blobs into Files with the same backing bytes. This
2148             was previously done as part of FormData::appendKeyValuePairItems.
2149
2150         * html/HTMLKeygenElement.cpp:
2151         (WebCore::HTMLKeygenElement::appendFormData):
2152
2153             Remove unnecessary conversion to utf8, the data is base64 encoded, allowing
2154             us to remove an overload of appendData that took a CString.
2155
2156         * inspector/InspectorNetworkAgent.cpp:
2157         (WebCore::buildObjectForResourceRequest):
2158
2159             Update for new signature of FormData::flatten() which now
2160             returns a Vector, rather than takes one in.
2161
2162         * platform/network/FormData.h:
2163         * platform/network/FormData.cpp:
2164         (WebCore::FormData::FormData):
2165         (WebCore::FormData::create):
2166         (WebCore::FormData::createMultiPart):
2167         
2168             Cleanup redundancy by using auto.
2169         
2170         (WebCore::FormData::appendKeyValuePairItems):
2171         
2172             Updated to handle new FormDataList item format (e.g. pairs of key / data) allowing
2173             us to remove two-by-two iteration. Some complexity was removed around Blobs, as
2174             FormDataList now always creates File. 
2175
2176             Since FormDataList no longer eagerly encodes / normalizes the keys and string data
2177             values, we now perform those operations here.
2178         
2179         (WebCore::FormData::expandDataStore):
2180         (WebCore::appendBlobResolved):
2181         (WebCore::FormData::resolveBlobReferences):
2182         (WebCore::FormData::generateFiles):
2183         (WebCore::FormData::hasGeneratedFiles const):
2184         (WebCore::FormData::hasOwnedGeneratedFiles const):
2185         (WebCore::FormData::removeGeneratedFilesIfNeeded):
2186
2187             Adopt auto and modern for-in loops.
2188
2189         (WebCore::FormData::flatten const):
2190         (WebCore::FormData::flattenToString const):
2191
2192             Update flatten to return a Vector, rather than take it in.
2193
2194 2017-09-10  Darin Adler  <darin@apple.com>
2195
2196         Refactor Document::updateTitleElement to use traits instead of function pointers
2197         https://bugs.webkit.org/show_bug.cgi?id=176671
2198
2199         Reviewed by Sam Weinig.
2200
2201         This template implementation seems slightly more readable and
2202         also likely to be slightly more efficient. Also takes a suggestion
2203         from Antti of factoring out the "select a new title element" into a
2204         function, which is a natural thing to do in this version.
2205
2206         * dom/Document.cpp:
2207         (WebCore::TitleTraits<HTMLTitleElement>::isInEligibleLocation): Added.
2208         (WebCore::TitleTraits<HTMLTitleElement>::findTitleElement): Added.
2209         (WebCore::TitleTraits<SVGTitleElement>::isInEligibleLocation): Added.
2210         (WebCore::TitleTraits<SVGTitleElement>::findTitleElement): Added.
2211         (WebCore::selectNewTitleElement): Added.
2212         (WebCore::findHTMLTitle): Deleted.
2213         (WebCore::isHTMLTitle): Deleted.
2214         (WebCore::isHTMLTitleEligible): Deleted.
2215         (WebCore::findSVGTitle): Deleted.
2216         (WebCore::isSVGTitle): Deleted.
2217         (WebCore::isSVGTitleEligible): Deleted.
2218         (WebCore::Document::updateTitleElement): Call selectNewTitleElement
2219         instead of having the logic here.
2220
2221 2017-09-07  Darin Adler  <darin@apple.com>
2222
2223         Fix double resolve assertion in FontFaceSet seen while running tests
2224         https://bugs.webkit.org/show_bug.cgi?id=176525
2225
2226         Reviewed by Brent Fulgham.
2227
2228         * css/FontFaceSet.cpp:
2229         (WebCore::FontFaceSet::FontFaceSet): Only resolve the promise if the CSSFontFaceSet
2230         is already loaded. Otherwise, we will resolve it later when it calls completedLoading.
2231
2232 2017-09-08  Dean Jackson  <dino@apple.com>
2233
2234         gl.detachShader breaks shader program
2235         https://bugs.webkit.org/show_bug.cgi?id=137689
2236         <rdar://problem/34025056>
2237
2238         Reviewed by Sam Weinig.
2239
2240         It should be possible to compile shaders, attach them to a program,
2241         link the program, detach the shaders, delete the shaders, and then
2242         ask for the uniform and attribute locations. That is, once you've
2243         linked, the shaders can be thrown away.
2244
2245         We were using the attached shaders to look up uniform locations, so
2246         we now keep around a separate map that remembers what shaders were
2247         attached when the program links.
2248
2249         This fixes the bug, but the whole area is still a bit messy. For one,
2250         we're keeping around all the shader information even after it is
2251         no longer used.
2252         See https://bugs.webkit.org/show_bug.cgi?id=98204
2253
2254         Test: fast/canvas/webgl/detachShader-before-accessing-uniform.html
2255
2256         * platform/graphics/GraphicsContext3D.h: Add another map to remember
2257         what shaders were used when a program was linked.
2258         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2259         (WebCore::GraphicsContext3D::mappedSymbolInShaderSourceMap): New helper
2260         to look up a name in our source maps.
2261         (WebCore::GraphicsContext3D::mappedSymbolName): Use the helper, and look
2262         at linked shaders if there are no attached shaders.
2263         (WebCore::GraphicsContext3D::originalSymbolInShaderSourceMap): Does the
2264         reverse of the above.
2265         (WebCore::GraphicsContext3D::originalSymbolName):
2266         (WebCore::GraphicsContext3D::linkProgram): Add to the new map.
2267         (WebCore::GraphicsContext3D::deleteProgram): Delete the program from
2268         our shader entries.
2269
2270 2017-09-09  Mark Lam  <mark.lam@apple.com>
2271
2272         Avoid duplicate computations of ExecState::vm().
2273         https://bugs.webkit.org/show_bug.cgi?id=176647
2274
2275         Reviewed by Saam Barati.
2276
2277         No new tests because this is only a refactoring patch.  There is no
2278         significant behavior change.
2279
2280         * Modules/mediastream/SDPProcessor.cpp:
2281         (WebCore::SDPProcessor::callScript const):
2282         * Modules/plugins/QuickTimePluginReplacement.mm:
2283         (WebCore::QuickTimePluginReplacement::installReplacement):
2284         * bindings/js/JSCallbackData.cpp:
2285         (WebCore::JSCallbackData::invokeCallback):
2286         * bindings/js/JSCustomElementInterface.cpp:
2287         (WebCore::constructCustomElementSynchronously):
2288         (WebCore::JSCustomElementInterface::upgradeElement):
2289         (WebCore::JSCustomElementInterface::invokeCallback):
2290         * bindings/js/JSDOMConvertRecord.h:
2291         * bindings/js/JSDOMMapLike.h:
2292         (WebCore::forwardSizeToMapLike):
2293         (WebCore::forwardEntriesToMapLike):
2294         (WebCore::forwardKeysToMapLike):
2295         (WebCore::forwardValuesToMapLike):
2296         (WebCore::forwardGetToMapLike):
2297         (WebCore::forwardHasToMapLike):
2298         * bindings/js/JSDOMWindowCustom.cpp:
2299         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2300         (WebCore::addCrossOriginWindowOwnPropertyNames):
2301         * bindings/js/JSDocumentCustom.cpp:
2302         (WebCore::reportMemoryForDocumentIfFrameless):
2303         * bindings/js/JSErrorHandler.cpp:
2304         (WebCore::JSErrorHandler::handleEvent):
2305         * bindings/js/JSImageDataCustom.cpp:
2306         (WebCore::toJSNewlyCreated):
2307         * bindings/js/JSLocationCustom.cpp:
2308         (WebCore::getOwnPropertySlotCommon):
2309         (WebCore::putCommon):
2310         (WebCore::addCrossOriginLocationPropertyNames):
2311         (WebCore::addCrossOriginLocationOwnPropertyNames):
2312         (WebCore::JSLocation::defineOwnProperty):
2313         (WebCore::JSLocationPrototype::put):
2314         (WebCore::JSLocationPrototype::defineOwnProperty):
2315         * bindings/js/SerializedScriptValue.cpp:
2316         (WebCore::CloneSerializer::serialize):
2317         * bindings/scripts/CodeGeneratorJS.pm:
2318         (GenerateImplementation):
2319         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2320         (WebCore::setJSInterfaceNameConstructor):
2321         * bindings/scripts/test/JS/JSMapLike.cpp:
2322         (WebCore::setJSMapLikeConstructor):
2323         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2324         (WebCore::setJSReadOnlyMapLikeConstructor):
2325         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2326         (WebCore::setJSTestActiveDOMObjectConstructor):
2327         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2328         (WebCore::setJSTestCEReactionsConstructor):
2329         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2330         (WebCore::setJSTestCEReactionsStringifierConstructor):
2331         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2332         (WebCore::setJSTestCallTracerConstructor):
2333         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2334         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
2335         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2336         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
2337         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
2338         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2339         (WebCore::setJSTestDOMJITConstructor):
2340         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2341         (WebCore::setJSTestEnabledBySettingConstructor):
2342         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2343         (WebCore::setJSTestEventConstructorConstructor):
2344         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2345         (WebCore::setJSTestEventTargetConstructor):
2346         * bindings/scripts/test/JS/JSTestException.cpp:
2347         (WebCore::setJSTestExceptionConstructor):
2348         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2349         (WebCore::setJSTestGenerateIsReachableConstructor):
2350         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2351         (WebCore::setJSTestGlobalObjectConstructor):
2352         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2353         (WebCore::setJSTestIndexedSetterNoIdentifierConstructor):
2354         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2355         (WebCore::setJSTestIndexedSetterThrowingExceptionConstructor):
2356         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2357         (WebCore::setJSTestIndexedSetterWithIdentifierConstructor):
2358         * bindings/scripts/test/JS/JSTestInterface.cpp:
2359         (WebCore::setJSTestInterfaceConstructor):
2360         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2361         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
2362         * bindings/scripts/test/JS/JSTestIterable.cpp:
2363         (WebCore::setJSTestIterableConstructor):
2364         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2365         (WebCore::setJSTestJSBuiltinConstructorConstructor):
2366         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2367         (WebCore::setJSTestMediaQueryListListenerConstructor):
2368         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2369         (WebCore::setJSTestNamedAndIndexedSetterNoIdentifierConstructor):
2370         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2371         (WebCore::setJSTestNamedAndIndexedSetterThrowingExceptionConstructor):
2372         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2373         (WebCore::setJSTestNamedAndIndexedSetterWithIdentifierConstructor):
2374         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2375         (WebCore::setJSTestNamedConstructorConstructor):
2376         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2377         (WebCore::setJSTestNamedDeleterNoIdentifierConstructor):
2378         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2379         (WebCore::setJSTestNamedDeleterThrowingExceptionConstructor):
2380         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2381         (WebCore::setJSTestNamedDeleterWithIdentifierConstructor):
2382         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2383         (WebCore::setJSTestNamedDeleterWithIndexedGetterConstructor):
2384         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2385         (WebCore::setJSTestNamedGetterCallWithConstructor):
2386         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2387         (WebCore::setJSTestNamedGetterNoIdentifierConstructor):
2388         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2389         (WebCore::setJSTestNamedGetterWithIdentifierConstructor):
2390         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2391         (WebCore::setJSTestNamedSetterNoIdentifierConstructor):
2392         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2393         (WebCore::setJSTestNamedSetterThrowingExceptionConstructor):
2394         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2395         (WebCore::setJSTestNamedSetterWithIdentifierConstructor):
2396         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2397         (WebCore::setJSTestNamedSetterWithIndexedGetterConstructor):
2398         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2399         (WebCore::setJSTestNamedSetterWithIndexedGetterAndSetterConstructor):
2400         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2401         (WebCore::setJSTestNamedSetterWithOverrideBuiltinsConstructor):
2402         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2403         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesConstructor):
2404         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2405         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
2406         * bindings/scripts/test/JS/JSTestNode.cpp:
2407         (WebCore::setJSTestNodeConstructor):
2408         * bindings/scripts/test/JS/JSTestObj.cpp:
2409         (WebCore::setJSTestObjConstructor):
2410         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2411         (WebCore::setJSTestOverloadedConstructorsConstructor):
2412         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2413         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
2414         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2415         (WebCore::setJSTestOverrideBuiltinsConstructor):
2416         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2417         (WebCore::setJSTestPluginInterfaceConstructor):
2418         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2419         (WebCore::setJSTestPromiseRejectionEventConstructor):
2420         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2421         (WebCore::setJSTestSerializationConstructor):
2422         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
2423         (WebCore::setJSTestSerializationIndirectInheritanceConstructor):
2424         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2425         (WebCore::setJSTestSerializationInheritConstructor):
2426         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2427         (WebCore::setJSTestSerializationInheritFinalConstructor):
2428         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2429         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
2430         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2431         (WebCore::setJSTestStringifierConstructor):
2432         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2433         (WebCore::setJSTestStringifierAnonymousOperationConstructor):
2434         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2435         (WebCore::setJSTestStringifierNamedOperationConstructor):
2436         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2437         (WebCore::setJSTestStringifierOperationImplementedAsConstructor):
2438         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2439         (WebCore::setJSTestStringifierOperationNamedToStringConstructor):
2440         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2441         (WebCore::setJSTestStringifierReadOnlyAttributeConstructor):
2442         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2443         (WebCore::setJSTestStringifierReadWriteAttributeConstructor):
2444         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2445         (WebCore::setJSTestTypedefsConstructor):
2446         * bridge/NP_jsobject.cpp:
2447         (_NPN_SetProperty):
2448         (_NPN_RemoveProperty):
2449         (_NPN_Enumerate):
2450         * bridge/c/c_instance.cpp:
2451         (JSC::Bindings::CRuntimeMethod::create):
2452         * bridge/objc/WebScriptObject.mm:
2453         (-[WebScriptObject setValue:forKey:]):
2454         (-[WebScriptObject removeWebScriptKey:]):
2455         (-[WebScriptObject setWebScriptValueAtIndex:value:]):
2456         * bridge/objc/objc_instance.mm:
2457         (ObjCRuntimeMethod::create):
2458         * bridge/objc/objc_runtime.h:
2459         (JSC::Bindings::ObjcFallbackObjectImp::create):
2460         * bridge/runtime_array.cpp:
2461         (JSC::RuntimeArray::getOwnPropertyNames):
2462         (JSC::RuntimeArray::getOwnPropertySlot):
2463         (JSC::RuntimeArray::put):
2464         * bridge/runtime_array.h:
2465         (JSC::RuntimeArray::create):
2466         * bridge/runtime_method.cpp:
2467         (JSC::RuntimeMethod::getOwnPropertySlot):
2468         * bridge/runtime_method.h:
2469         * html/HTMLMediaElement.cpp:
2470         (WebCore::HTMLMediaElement::updateCaptionContainer):
2471         (WebCore::HTMLMediaElement::setControllerJSProperty):
2472         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2473         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
2474         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
2475         * html/HTMLPlugInImageElement.cpp:
2476         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
2477         * testing/Internals.cpp:
2478         (WebCore::Internals::cloneArrayBuffer):
2479
2480 2017-09-09  Zan Dobersek  <zdobersek@igalia.com>
2481
2482         [EME] MediaKeySession: handle MediaKeys association through a WeakPtr
2483         https://bugs.webkit.org/show_bug.cgi?id=176584
2484
2485         Reviewed by Xabier Rodriguez-Calvar.
2486
2487         Don't keep a raw pointer to the originating MediaKeys object in
2488         MediaKeySession that gets nulled out once MediaKeys is destroyed.
2489         Instead, make MediaKeys a WeakPtrFactory and use a WeakPtr<MediaKeys>
2490         object to maintain the association between MediaKeySession and
2491         MediaKeys.
2492
2493         * Modules/encryptedmedia/MediaKeySession.cpp:
2494         (WebCore::MediaKeySession::create):
2495         (WebCore::MediaKeySession::MediaKeySession):
2496         (WebCore::MediaKeySession::detachKeys): Deleted.
2497         * Modules/encryptedmedia/MediaKeySession.h:
2498         * Modules/encryptedmedia/MediaKeys.cpp:
2499         (WebCore::MediaKeys::MediaKeys):
2500         (WebCore::MediaKeys::createSession):
2501         (WebCore::MediaKeys::~MediaKeys): Deleted.
2502         * Modules/encryptedmedia/MediaKeys.h:
2503
2504 2017-09-09  Zan Dobersek  <zdobersek@igalia.com>
2505
2506         [GStreamer] Missing GRefPtr adoptions in MediaPlayerPrivateGStreamerBase, PlaybackPipeline
2507         https://bugs.webkit.org/show_bug.cgi?id=176646
2508
2509         Reviewed by Carlos Garcia Campos.
2510
2511         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2512         (WebCore::registerWebKitGStreamerElements): Adopt the return value
2513         of gst_element_factory_find(), which is transferred in full.
2514         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2515         (WebCore::PlaybackPipeline::flush): Adopt the return values
2516         of gst_element_get_static_pad() and gst_pad_get_peer(), both being
2517         transferred in full.
2518
2519 2017-09-09  Frederic Wang  <fwang@igalia.com>
2520
2521         Use RenderLayerBacking::renderer() when possible
2522         https://bugs.webkit.org/show_bug.cgi?id=176585
2523
2524         The private member renderer() is a shorthand for m_owningLayer.renderer(). This patch uses
2525         it in RenderLayerBacking when possible.
2526
2527         Reviewed by Carlos Garcia Campos.
2528
2529         No new tests, behavior not changed.
2530
2531         * rendering/RenderLayerBacking.cpp:
2532         (WebCore::RenderLayerBacking::updateGeometry):
2533         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
2534         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
2535
2536 2017-09-08  Sam Weinig  <sam@webkit.org>
2537
2538         Replace JS builtin implementation of the FetchResponse constructor with a C++ one
2539         https://bugs.webkit.org/show_bug.cgi?id=176627
2540
2541         Reviewed by Alex Christensen.
2542
2543         Removes the last of the Fetch related JS builtin code.
2544
2545         * CMakeLists.txt:
2546         * DerivedSources.make:
2547         * WebCore.xcodeproj/project.pbxproj:
2548         * Modules/fetch/FetchInternals.js: Removed.
2549         * Modules/fetch/FetchResponse.js: Removed.
2550         
2551             Remove FetchInternals.js and FetchResponse.js.
2552
2553
2554         * Modules/fetch/FetchBody.idl:
2555         * Modules/fetch/FetchBodyConsumer.h:
2556
2557             Remove no longer correct FIXMEs.
2558
2559         * Modules/fetch/FetchBodySource.cpp:
2560
2561             Add missing newline between functions.
2562
2563         * Modules/fetch/FetchHeaders.idl:
2564         * Modules/fetch/FetchResponse.idl:
2565
2566             Remove builtin related operations and extended attributes.
2567
2568         * Modules/fetch/FetchHeaders.h:
2569         (WebCore::FetchHeaders::fastHas const):
2570         * Modules/fetch/FetchHeaders.cpp:
2571
2572             Added fastHas to allow checking for a header using a HTTPHeaderName. Remove
2573             now unused filter function.
2574
2575         * Modules/fetch/FetchResponse.cpp:
2576         (WebCore::isNullBodyStatus):
2577
2578             Added helper predicate for 'null body status' concept.
2579
2580         (WebCore::FetchResponse::create):
2581
2582             Add spec defined constructor implementation.
2583
2584         (WebCore::FetchResponse::setBodyData):
2585
2586             Reformatted to match more common WTF::switchOn style.
2587
2588         (WebCore::FetchResponse::setStatus): Deleted.
2589         (WebCore::FetchResponse::initializeWith): Deleted.
2590
2591             Removed now unused functions.
2592
2593         * Modules/fetch/FetchResponse.h:
2594         (WebCore::FetchResponse::create):
2595
2596             Move inline create out of the class definition to make things a bit less crowded.
2597
2598 2017-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2599
2600         Implement HTMLImageElement.decoode() method
2601         https://bugs.webkit.org/show_bug.cgi?id=176016
2602
2603         Reviewed by Simon Fraser.
2604
2605         The specs is:
2606         https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-decode.
2607
2608         -- img.decode() waits till loading the image finishes. Otherwise it starts
2609         decoding the image immediately.
2610         -- If the image frame is already decoded, the promise will be resolved
2611         before return.
2612         -- If an error happens in loading the image or decoding the image frame,
2613         the promise will be rejected with 'EncodingError' exception.
2614         -- Animated image resolves the promise when the next frame is decoded and 
2615         the animation is advanced it. If the image is not displayed, decode() will
2616         request the decoding the first frame and start animating the image.
2617
2618         Tests: fast/images/decode-animated-image.html
2619                fast/images/decode-render-animated-image.html
2620                fast/images/decode-render-static-image.html
2621                fast/images/decode-static-image-reject.html
2622                fast/images/decode-static-image-resolve.html
2623
2624         * html/HTMLImageElement.cpp:
2625         (WebCore::HTMLImageElement::decode):
2626         * html/HTMLImageElement.h:
2627         * html/HTMLImageElement.idl:
2628         * loader/ImageLoader.cpp:
2629         (WebCore::ImageLoader::notifyFinished):
2630         (WebCore::ImageLoader::decode):
2631         (WebCore::ImageLoader::decodeError):
2632         * loader/ImageLoader.h:
2633         (WebCore::ImageLoader::hasPendingDecodePromise const):
2634         * platform/graphics/BitmapImage.cpp:
2635         (WebCore::BitmapImage::internalStartAnimation):
2636         (WebCore::BitmapImage::internalAdvanceAnimation):
2637         (WebCore::BitmapImage::decode):
2638         (WebCore::BitmapImage::imageFrameAvailableAtIndex):
2639         * platform/graphics/BitmapImage.h:
2640         * platform/graphics/Image.h:
2641         (WebCore::Image::decode):
2642
2643 2017-09-08  Joseph Pecoraro  <pecoraro@apple.com>
2644
2645         Fetch's Response.statusText is unexpectedly the full http status line for HTTP/2 responses
2646         https://bugs.webkit.org/show_bug.cgi?id=176479
2647
2648         Reviewed by Alex Christensen.
2649
2650         Test: http/wpt/fetch/response-status-text.html
2651
2652         HTTP/2 doesn't include a status reason phrase. So the "status line"
2653         ends up just being the version and status code. Fallback to the empty
2654         string instead of the full line.
2655
2656         * platform/network/HTTPParsers.cpp:
2657         (WebCore::extractReasonPhraseFromHTTPStatusLine):
2658
2659 2017-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2660
2661         Implement the attribute HTMLImageElement.async 
2662         https://bugs.webkit.org/show_bug.cgi?id=176204
2663
2664         Reviewed by Darin Adler.
2665
2666         Adding this attribute to the <img> element will force async decoding for
2667         this image all the times. None of the heuristics, which  prevents flickering
2668         the image, will be checked.
2669
2670         Test: fast/images/async-attribute-with-small-image.html
2671
2672         * html/HTMLImageElement.cpp:
2673         (WebCore::HTMLImageElement::parseAttribute):
2674         * html/HTMLImageElement.h:
2675         (WebCore::HTMLImageElement::async const):
2676         * html/HTMLImageElement.idl:
2677         * rendering/RenderBoxModelObject.cpp:
2678         (WebCore::RenderBoxModelObject::decodingModeForImageDraw const):
2679
2680 2017-09-08  Commit Queue  <commit-queue@webkit.org>
2681
2682         Unreviewed, rolling out r221773.
2683         https://bugs.webkit.org/show_bug.cgi?id=176614
2684
2685         This caused build failures. (Requested by mlewis13 on
2686         #webkit).
2687
2688         Reverted changeset:
2689
2690         "[Mac] Upstream QTKit-related WebKitSystemInterface functions"
2691         https://bugs.webkit.org/show_bug.cgi?id=176472
2692         http://trac.webkit.org/changeset/221773
2693
2694 2017-09-08  Antti Koivisto  <antti@apple.com>
2695
2696         Remove support for >> descendant combinator syntax
2697         https://bugs.webkit.org/show_bug.cgi?id=175765
2698
2699         Reviewed by Sam Weinig.
2700
2701         This is an alternative syntax for the normal descendant combinator (just space) that was
2702         advertised as being consistent with > (child combinator) and >>> (shadow piercing combinator).
2703         The latter has been killed so it is not consistent with anything anymore.
2704
2705         No other engine besides WebKit has implemented this and the WPT tests have been removed
2706         (in https://github.com/w3c/web-platform-tests/pull/6785). Full removal from spec is still
2707         open (https://github.com/w3c/csswg-drafts/issues/641) but we shouldn't encourage adoption of
2708         this pointless feature.
2709
2710         While this has shipped the compatibility risk is low as no other engine implemented it and
2711         there were no incentives to use it over the standard syntax.
2712
2713         * css/CSSSelector.cpp:
2714         (WebCore::CSSSelector::selectorText const):
2715         * css/CSSSelector.h:
2716         (WebCore::CSSSelector::hasDescendantRelation const):
2717         * css/SelectorChecker.cpp:
2718         (WebCore::SelectorChecker::matchRecursively const):
2719         * css/SelectorFilter.cpp:
2720         (WebCore::SelectorFilter::collectIdentifierHashes):
2721         * css/parser/CSSParserSelector.cpp:
2722         (WebCore::CSSParserSelector::appendTagHistory):
2723         * css/parser/CSSParserSelector.h:
2724         * css/parser/CSSSelectorParser.cpp:
2725         (WebCore::isDescendantCombinator):
2726         (WebCore::CSSSelectorParser::consumeCombinator):
2727         * cssjit/SelectorCompiler.cpp:
2728         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
2729
2730 2017-09-08  Zan Dobersek  <zdobersek@igalia.com>
2731
2732         [GStreamer] initializationDataEncountered() dispatch can outlive MediaPlayerPrivateGStreamerBase
2733         https://bugs.webkit.org/show_bug.cgi?id=176544
2734
2735         Reviewed by Xabier Rodriguez-Calvar.
2736
2737         The RunLoop dispatch that invokes MediaPlayer::initializationDataEncountered()
2738         can outlive the MediaPlayerPrivateGStreamerBase object that is referenced
2739         from the dispatched functor. To avoid this, a WeakPtrFactory is placed onto
2740         MediaPlayerPrivateGStreamerBase and a WeakPtr object is kept in the functor,
2741         bailing during dispatch if the factory (along with MediaPlayerPrivateGStreamerBase)
2742         has already been destroyed since the schedule of this dispatch.
2743
2744         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2745         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
2746         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2747         Also remove the unused `sessionId` string.
2748         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2749
2750 2017-09-08  Zan Dobersek  <zdobersek@igalia.com>
2751
2752         [GStreamer] Add GRefPtr specializations for GstGLDisplay, GstGLContext
2753         https://bugs.webkit.org/show_bug.cgi?id=176543
2754
2755         Reviewed by Xabier Rodriguez-Calvar.
2756
2757         Both GstGLDisplay and GstGLContext inherit from GstObject, meaning
2758         gst_object_ref_sink() and gst_object_unref() should be used for
2759         incrementing and decrementing reference count. Template specializations
2760         for the adoptGRef(), refGPtr() and derefGPtr() are added for both types,
2761         preventing GRefPtr<> from falling back to using g_object_ref() and
2762         g_object_unref() for reference count modification purposes.
2763
2764         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
2765         (WTF::adoptGRef):
2766         (WTF::refGPtr<GstGLDisplay>):
2767         (WTF::derefGPtr<GstGLDisplay>):
2768         (WTF::refGPtr<GstGLContext>):
2769         (WTF::derefGPtr<GstGLContext>):
2770         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2771
2772 2017-09-08  Zan Dobersek  <zdobersek@igalia.com>
2773
2774         [GStreamer] Incorrect GstCaps unreffing in GStreamerEMEUtilities::createDecryptor()
2775         https://bugs.webkit.org/show_bug.cgi?id=176540
2776
2777         Reviewed by Xabier Rodriguez-Calvar.
2778
2779         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
2780         Include the GRefPtrGStreamer.h header in order to use specialized template
2781         functions that correctly adopt and dereference GstCaps object that is
2782         wrapped the GRefPtr<>.
2783
2784 2017-09-07  Joseph Pecoraro  <pecoraro@apple.com>
2785
2786         WebKit should claim that it can show responses for a broader range of JSON MIMETypes
2787         https://bugs.webkit.org/show_bug.cgi?id=176252
2788         <rdar://problem/34212885>
2789
2790         Reviewed by Ryosuke Niwa.
2791
2792         * platform/MIMETypeRegistry.h:
2793         * platform/MIMETypeRegistry.cpp:
2794         (WebCore::MIMETypeRegistry::canShowMIMEType):
2795         Extend this to support JavaScript and JSON MIMETypes that WebKit
2796         knows how to treat as text.
2797
2798 2017-09-07  Andy Estes  <aestes@apple.com>
2799
2800         [Mac] Upstream QTKit-related WebKitSystemInterface functions
2801         https://bugs.webkit.org/show_bug.cgi?id=176472
2802
2803         Reviewed by Eric Carlson.
2804
2805         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2806         (WebCore::disableComponentsOnce):
2807         (WebCore::MediaPlayerPrivateQTKit::createQTMovie):
2808         (WebCore::MediaPlayerPrivateQTKit::hasClosedCaptions const):
2809         (WebCore::MediaPlayerPrivateQTKit::setClosedCaptionsVisible):
2810         (WebCore::selectPreferredAlternateTrackForMediaType):
2811         (WebCore::selectPreferredAlternates):
2812         (WebCore::MediaPlayerPrivateQTKit::updateStates):
2813         (WebCore::mimeModernTypesCache):
2814         (WebCore::MediaPlayerPrivateQTKit::originsInMediaCache):
2815         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
2816         (WebCore::MediaPlayerPrivateQTKit::clearMediaCacheForOrigins):
2817         (WebCore::MediaPlayerPrivateQTKit::hasSingleSecurityOrigin const):
2818         (WebCore::MediaPlayerPrivateQTKit::movieLoadType const):
2819         (WebCore::MediaPlayerPrivateQTKit::canSaveMediaData const):
2820         * platform/mac/WebCoreSystemInterface.h:
2821         * platform/mac/WebCoreSystemInterface.mm:
2822         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2823         (createMediaUIControl):
2824         (createControlWithMediaUIControlType):
2825         (createMediaUIBackgroundView):
2826         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
2827
2828 2017-09-07  Youenn Fablet  <youenn@apple.com>
2829
2830         Align FetchResponse and FetchRequest body handling
2831         https://bugs.webkit.org/show_bug.cgi?id=176539
2832
2833         Reviewed by Alex Christensen.
2834
2835         Covered by rebased tests.
2836
2837         Removing most of FetchResponse JS Builtins now that ReadableStream has full support.
2838         Implementing FetchResponse body cloning through ReadableStream.
2839         Cloning a loading FetchResponse still requires to create a ReadableStream for the purpose of teeing.
2840
2841         Moving exposure of the body from FetchResponse to FetchBodyOwner.
2842         This is controlled by a boolean flag set according response tainting.
2843
2844         Moving handling of body ReadableStream consuming from FetchResponse to FetchBodyConsumer.
2845         For that purpose, a loading boolean flag is added to FetchBodyConsumer so that it will resolve consume promises
2846         when loading is finished.
2847
2848         Added support for getting a body in case the request/response body is already consumed.
2849         In that case, a locked ReadableStream is returned.
2850
2851         * Modules/cache/DOMCache.cpp:
2852         (WebCore::DOMCache::doMatch):
2853         (WebCore::DOMCache::matchAll):
2854         * Modules/fetch/FetchBody.h:
2855         (WebCore::FetchBody::loadingBody):
2856         (WebCore::FetchBody::FetchBody):
2857         * Modules/fetch/FetchBody.idl:
2858         * Modules/fetch/FetchBodyConsumer.cpp:
2859         (WebCore::FetchBodyConsumer::resolve):
2860         (WebCore::FetchBodyConsumer::loadingFailed):
2861         (WebCore::FetchBodyConsumer::loadingSucceeded):
2862         * Modules/fetch/FetchBodyConsumer.h:
2863         (WebCore::FetchBodyConsumer::setAsLoading):
2864         * Modules/fetch/FetchBodyOwner.cpp:
2865         (WebCore::FetchBodyOwner::arrayBuffer):
2866         (WebCore::FetchBodyOwner::blob):
2867         (WebCore::FetchBodyOwner::formData):
2868         (WebCore::FetchBodyOwner::json):
2869         (WebCore::FetchBodyOwner::text):
2870         (WebCore::FetchBodyOwner::readableStream):
2871         * Modules/fetch/FetchBodyOwner.h:
2872         (WebCore::FetchBodyOwner::isBodyNullOrOpaque const):
2873         (WebCore::FetchBodyOwner::setBodyAsOpaque):
2874         (WebCore::FetchBodyOwner::isBodyOpaque const):
2875         * Modules/fetch/FetchInternals.js:
2876         (fillFetchHeaders):
2877         * Modules/fetch/FetchResponse.cpp:
2878         (WebCore::FetchResponse::clone):
2879         (WebCore::FetchResponse::fetch):
2880         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
2881         (WebCore::FetchResponse::setBodyData):
2882         (WebCore::FetchResponse::consumeChunk):
2883         (WebCore::FetchResponse::consumeBodyAsStream):
2884         * Modules/fetch/FetchResponse.h:
2885         * Modules/fetch/FetchResponse.idl:
2886         * Modules/fetch/FetchResponse.js:
2887         (initializeFetchResponse):
2888         * bindings/js/ReadableStream.cpp:
2889         (WebCore::ReadableStream::create):
2890         (WebCore::ReadableStream::lock):
2891         * bindings/js/ReadableStream.h:
2892         * bindings/js/WebCoreBuiltinNames.h:
2893
2894 2017-09-07  Michael Saboff  <msaboff@apple.com>
2895
2896         Add support for RegExp named capture groups
2897         https://bugs.webkit.org/show_bug.cgi?id=176435
2898
2899         Reviewed by Filip Pizlo.
2900
2901         Implemented stub routines to support named capture groups.  These are no-ops
2902         just like for number capture group.
2903
2904         No new tests as this is covered by existing tests.
2905
2906         * contentextensions/URLFilterParser.cpp:
2907         (WebCore::ContentExtensions::PatternParser::atomNamedBackReference):
2908         (WebCore::ContentExtensions::PatternParser::atomParenthesesSubpatternBegin):
2909
2910 2017-09-07  Myles C. Maxfield  <mmaxfield@apple.com>
2911
2912         [PAL] Unify PlatformUserPreferredLanguages.h with Language.h
2913         https://bugs.webkit.org/show_bug.cgi?id=176561
2914
2915         Reviewed by Brent Fulgham.
2916
2917         No new tests because there is no behavior change.
2918
2919         * CMakeLists.txt:
2920         * WebCore.xcodeproj/project.pbxproj:
2921         * accessibility/AccessibilitySVGElement.cpp:
2922         * bindings/js/JSDOMWindowBase.cpp:
2923         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2924         * dom/Document.cpp:
2925         * html/HTMLInputElement.cpp:
2926         * html/HTMLMediaElement.cpp:
2927         * html/shadow/MediaControlElements.cpp:
2928         * html/track/TrackBase.cpp:
2929         * page/CaptionUserPreferences.cpp:
2930         * page/CaptionUserPreferencesMediaAF.cpp:
2931         * page/DOMWindow.cpp:
2932         * page/Navigator.cpp:
2933         * page/NavigatorBase.cpp:
2934         * platform/graphics/FontGenericFamilies.cpp:
2935         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2936         * platform/network/HTTPParsers.cpp:
2937         * platform/text/PlatformLocale.h:
2938         * platform/text/cf/HyphenationCF.cpp:
2939         * platform/text/mac/LocaleMac.mm:
2940         * svg/SVGTests.cpp:
2941         * testing/InternalSettings.cpp:
2942         * testing/Internals.cpp:
2943         (WebCore::Internals::resetToConsistentState):
2944         (WebCore::Internals::userPreferredLanguages const):
2945         (WebCore::Internals::setUserPreferredLanguages):
2946
2947 2017-09-06  Dean Jackson  <dino@apple.com>
2948
2949         [WebGL] accelerated texImage2D for video doesn't respect flipY
2950         https://bugs.webkit.org/show_bug.cgi?id=176491
2951         <rdar://problem/33833511>
2952
2953         Reviewed by Jer Noble.
2954
2955         Previously, if UNPACK_FLIP_Y_WEBGL was set to true, we'd either fall
2956         back to software or fail to upload texture data. Fix this by intercepting
2957         the texImage2D call, checking the orientation of the video, and running
2958         a small shader program to flip it if necessary.
2959
2960         While there, implement UNPACK_PREMULTIPLY_ALPHA_WEBGL as well, although
2961         none of our media decoders support video with alpha, so unfortunately
2962         this will have no visible change.
2963
2964         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
2965                fast/canvas/webgl/texImage2D-video-flipY-true.html
2966
2967         * platform/cocoa/CoreVideoSoftLink.cpp: Add link to CVOpenGL(ES)TextureGetCleanTexCoords,
2968         which is used to check the orientation of the source video.
2969         * platform/cocoa/CoreVideoSoftLink.h:
2970
2971         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2972         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): We can
2973         now handle flipped or premultiplied requests.
2974         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2975         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): Ditto.
2976
2977         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2978         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): Rename readFramebuffer to
2979         simply framebuffer.
2980         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): Delete the program and buffer
2981         if they were created.
2982         (WebCore::VideoTextureCopierCV::initializeContextObjects): Sets up the shader program
2983         and the vertex buffer for drawing. Also records the location of the uniforms.
2984         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Create a new
2985         framebuffer object, and render the video texture into that framebuffer using a
2986         shader that can flip the coordinates.
2987         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): Helper to restore
2988         the state of the user's GraphicsContext3D while we're intercepting calls.
2989         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
2990         * platform/graphics/cv/VideoTextureCopierCV.h:
2991
2992         * platform/graphics/GraphicsContext3D.h: Add two new entry points, for direct shader
2993         compilation and attribute access. This avoids going through ANGLE.
2994         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2995         (WebCore::GraphicsContext3D::compileShader):
2996         (WebCore::GraphicsContext3D::compileShaderDirect):
2997         (WebCore::GraphicsContext3D::getAttribLocationDirect):
2998
2999 2017-09-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3000
3001         [Directory Upload] Extend drag and drop support to iOS
3002         https://bugs.webkit.org/show_bug.cgi?id=176492
3003         <rdar://problem/34291584>
3004
3005         Reviewed by Tim Horton.
3006
3007         Adds support for accepting dropped folders on iOS.
3008
3009         Tests: DataInteractionTests.ExternalSourceDataTransferItemGetFolderAsEntry
3010                DataInteractionTests.ExternalSourceDataTransferItemGetPlainTextFileAsEntry
3011
3012         * platform/ios/PasteboardIOS.mm:
3013         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
3014
3015         Add "public.folder" as a compatible pasteboard type for drops on iOS. This means file inputs and custom drop
3016         targets that preventDefault() will, by default, be able to accept incoming folders.
3017
3018         * platform/ios/WebItemProviderPasteboard.mm:
3019         (linkTemporaryItemProviderFilesToDropStagingDirectory):
3020
3021         Tweak temporaryFileURLForDataInteractionContent to also hard link UIKit's temporary files instead, and return
3022         a non-null destination URL only if the necessary file operations succeeded. Also renames this helper to
3023         linkTemporaryItemProviderFilesToDropStagingDirectory to better reflect its new purpose. This makes logic much
3024         cleaner at the call site, which no longer checks against various conditions before proceeding to set the data
3025         transfer URL.
3026
3027         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3028         (temporaryFileURLForDataInteractionContent): Deleted.
3029
3030 2017-09-07  Alex Christensen  <achristensen@webkit.org>
3031
3032         Modernize Geolocation code
3033         https://bugs.webkit.org/show_bug.cgi?id=176496
3034
3035         Reviewed by Andy Estes.
3036
3037         No change in behavior.  Just more references instead of pointers.
3038
3039         * Modules/geolocation/Geolocation.cpp:
3040         (WebCore::createPositionError):
3041         (WebCore::Geolocation::resetAllGeolocationPermission):
3042         (WebCore::Geolocation::stop):
3043         (WebCore::Geolocation::requestPermission):
3044         (WebCore::Geolocation::setError):
3045         (WebCore::Geolocation::startUpdating):
3046         (WebCore::Geolocation::stopUpdating):
3047         * Modules/geolocation/Geolocation.h:
3048         * Modules/geolocation/GeolocationClient.h:
3049         * Modules/geolocation/GeolocationController.cpp:
3050         (WebCore::GeolocationController::addObserver):
3051         (WebCore::GeolocationController::removeObserver):
3052         (WebCore::GeolocationController::requestPermission):
3053         (WebCore::GeolocationController::cancelPermissionRequest):
3054         (WebCore::GeolocationController::positionChanged):
3055         (WebCore::GeolocationController::errorOccurred):
3056         (WebCore::GeolocationController::activityStateDidChange):
3057         (WebCore::provideGeolocationTo):
3058         * Modules/geolocation/GeolocationController.h:
3059
3060 2017-09-07  Adrian Perez de Castro  <aperez@igalia.com>
3061
3062         [ARM] Building FELightningNEON.cpp fails due to missing {Point,Spot}LightSource declarations
3063         https://bugs.webkit.org/show_bug.cgi?id=176531
3064
3065         Reviewed by Žan Doberšek.
3066
3067         The m_lightSource member is a Ref<LightSource>, and its get() method returns
3068         a reference, therefore the casts have to be done to the corresponding reference
3069         types.
3070
3071         * platform/graphics/cpu/arm/filters/FELightingNEON.h:
3072         (WebCore::FELighting::platformApplyNeon): Adjust casts and member accesses accordingly.
3073
3074 2017-09-07  Ryan Haddad  <ryanhaddad@apple.com>
3075
3076         Unreviewed, rolling out r221716.
3077
3078         This change caused assertion failures on macOS Debug WK2.
3079
3080         Reverted changeset:
3081
3082         "Fetch's Response.statusText is unexpectedly the full http
3083         status line for HTTP/2 responses"
3084         https://bugs.webkit.org/show_bug.cgi?id=176479
3085         http://trac.webkit.org/changeset/221716
3086
3087 2017-09-07  Zan Dobersek  <zdobersek@igalia.com>
3088
3089         [EME] CDMClearKey: implement remaining methods of CDMPrivate derivative
3090         https://bugs.webkit.org/show_bug.cgi?id=176495
3091
3092         Reviewed by Xabier Rodriguez-Calvar.
3093
3094         Implement the remaining CDMPrivateClearKey methods, following the
3095         ClearKey specification:
3096          - server certificates are not supported, but sessions are;
3097          - 'keyids' init data in JSON format is acceptable;
3098          - JSON responses are acceptable;
3099          - session IDs must use the 32-bit integer format.
3100
3101         No new tests -- covered by imported W3C tests that utilize ClearKey.
3102
3103         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3104         (WebCore::parseJSONObject):
3105         (WebCore::CDMPrivateClearKey::loadAndInitialize):
3106         (WebCore::CDMPrivateClearKey::supportsServerCertificates const):
3107         (WebCore::CDMPrivateClearKey::supportsSessions const):
3108         (WebCore::CDMPrivateClearKey::supportsInitData const):
3109         (WebCore::CDMPrivateClearKey::sanitizeResponse const):
3110         (WebCore::CDMPrivateClearKey::sanitizeSessionId const):
3111
3112 2017-09-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3113
3114         [GTK] Bring back line height rounding when computing font metrics
3115         https://bugs.webkit.org/show_bug.cgi?id=176497
3116
3117         Reviewed by Žan Doberšek.
3118
3119         In r221670 we changed the way we get the metrics to avoid rounding that was causing a negative line gap to be
3120         computed. Since the font metrics value is indeed a float value, we also removed the rounding when setting the
3121         line height. However, this caused some test failures because now we report non integer line heights.
3122
3123         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3124         (WebCore::Font::platformInit):
3125
3126 2017-09-06  Carlos Garcia Campos  <cgarcia@igalia.com>
3127
3128         Unreviewed. Temporary disable the changes introduced in r221670 for WPE.
3129
3130         It caused a lot of test failures. Once WPE upgrades to Freetype 2.8 and removes the 2.4.11 patch, we can enable
3131         it again.
3132
3133         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3134         (WebCore::Font::platformInit):
3135
3136 2017-09-06  Zan Dobersek  <zdobersek@igalia.com>
3137
3138         [GStreamer] Implement MediaPlayerPrivateGStreamerMSE::attempToDecryptWithInstance()
3139         https://bugs.webkit.org/show_bug.cgi?id=176445
3140
3141         Reviewed by Xabier Rodriguez-Calvar.
3142
3143         Implement MediaPlayerPrivateGStreamerMSE::attempToDecryptWithInstance(), also
3144         adding support for dispatching ClearKey keys into the append pipelines.
3145
3146         CDMInstanceClearKey::Key is added, containing key ID and value buffers as well
3147         as the key status value. Vector of keys for a specific CDMInstance is
3148         accessible through the CDMInstanceClearKey::keys() getter.
3149
3150         In MediaPlayerPrivateGStreamerMSE, that Vector is retrieved and then iterated
3151         over, constructing corresponding key ID and key value lists that contain
3152         GstBuffer objects into which each key ID and value data is copied. Both lists
3153         are then set on the 'drm-cipher-clearkey' structure before it's dispatched
3154         against each AppendPipeline object.
3155
3156         * platform/encryptedmedia/clearkey/CDMClearKey.h:
3157         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3158         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
3159         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3160
3161 2017-09-06  Joseph Pecoraro  <pecoraro@apple.com>
3162
3163         Fetch's Response.statusText is unexpectedly the full http status line for HTTP/2 responses
3164         https://bugs.webkit.org/show_bug.cgi?id=176479
3165
3166         Reviewed by Alexey Proskuryakov.
3167
3168         Test: http/wpt/fetch/response-status-text.html
3169
3170         HTTP/2 doesn't include a status reason phrase. So the "status line"
3171         ends up just being the version and status code. Fallback to the empty
3172         string instead of the full line.
3173
3174         * platform/network/HTTPParsers.cpp:
3175         (WebCore::extractReasonPhraseFromHTTPStatusLine):
3176
3177 2017-09-06  Eric Carlson  <eric.carlson@apple.com>
3178
3179         Require LoggingHelper overrides to provide identifier
3180         https://bugs.webkit.org/show_bug.cgi?id=176477
3181
3182         Reviewed by Jer Noble.
3183
3184         No new tests, updated API test.
3185
3186         * html/HTMLMediaElement.cpp:
3187         (WebCore::nextLogIdentifier): New.
3188         (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_logIdendifier. LOGTHIS -> LOGIDENTIFIER.
3189         (WebCore::HTMLMediaElement::~HTMLMediaElement): Ditto.
3190         * html/HTMLMediaElement.h:
3191
3192 2017-09-06  Youenn Fablet  <youenn@apple.com>
3193
3194         NetworkProcess Cache and Caches should be cleared when the last related WebProcess Cache or CacheStorage is destroyed
3195         https://bugs.webkit.org/show_bug.cgi?id=176249
3196
3197         Reviewed by Alex Christensen.
3198
3199         Test: http/tests/cache-storage/cache-representation.https.html
3200
3201         Each Cache construction/destruction is notified to the CacheStorageConnection
3202         so that the WebKit2 engine can handle memory management accordingly.
3203
3204         Adding an internal API to grab the representation of an engine at any time.
3205
3206         * Modules/cache/Cache.cpp:
3207         (WebCore::Cache::Cache):
3208         (WebCore::Cache::~Cache):
3209         * Modules/cache/CacheStorageConnection.h:
3210         (WebCore::CacheStorageConnection::reference):
3211         (WebCore::CacheStorageConnection::dereference):
3212         * Modules/cache/WorkerCacheStorageConnection.cpp:
3213         (WebCore::WorkerCacheStorageConnection::reference):
3214         (WebCore::WorkerCacheStorageConnection::dereference):
3215         * Modules/cache/WorkerCacheStorageConnection.h:
3216         * testing/Internals.cpp:
3217         (WebCore::Internals::cacheStorageEngineRepresentation):
3218         * testing/Internals.h:
3219         * testing/Internals.idl:
3220
3221 2017-09-05  Matt Rajca  <mrajca@apple.com>
3222
3223         Support new autoplay quirk for arbitrary user gestures.
3224         https://bugs.webkit.org/show_bug.cgi?id=176402
3225
3226         Reviewed by Eric Carlson.
3227
3228         This quirk allows any user gesture to allow autoplay in a document.
3229
3230         No new tests because this specifically targets one host.
3231
3232         * html/MediaElementSession.cpp:
3233         (WebCore::needsArbitraryUserGestureAutoplayQuirk):
3234         (WebCore::MediaElementSession::playbackPermitted const):
3235
3236 2017-09-06  Youenn Fablet  <youenn@apple.com>
3237
3238         Support caching of Response with a ReadableStream body
3239         https://bugs.webkit.org/show_bug.cgi?id=176462
3240
3241         Reviewed by Alex Christensen.
3242
3243         Tests: http/wpt/cache-storage/cache-put-stream.https.any.html
3244                http/wpt/cache-storage/cache-put-stream.https.any.worker.html
3245
3246         Making FetchResponse use more of ReadableStream:
3247         - Cloning of its body is done through ReadableStream.
3248         - Computation of disturbed and locked is done through ReadableStream.
3249         - Storing of the ReadableStream body given at constructor time is done in FetchBody for FetchResponse.
3250         This allows making FetchResponse closer to FetchRequest.
3251         This also allows to correctly compute disturbed and locked in clone cases.
3252
3253         Adding the ability to consume a Response ReadableStream body as a SharedBuffer.
3254         Using that ability in DOMCache.
3255
3256         * Modules/cache/DOMCache.cpp:
3257         (WebCore::DOMCache::putWithResponseData):
3258         (WebCore::DOMCache::put):
3259         * Modules/cache/DOMCache.h:
3260         * Modules/fetch/FetchBody.h:
3261         (WebCore::FetchBody::readableStream const):
3262         * Modules/fetch/FetchBodyConsumer.cpp:
3263         (WebCore::FetchBodyConsumer::extract):
3264         * Modules/fetch/FetchBodyConsumer.h:
3265         * Modules/fetch/FetchBodyOwner.cpp:
3266         (WebCore::FetchBodyOwner::isDisturbed const):
3267         (WebCore::FetchBodyOwner::isDisturbedOrLocked const):
3268         * Modules/fetch/FetchBodyOwner.h:
3269         (WebCore::FetchBodyOwner::hasReadableStreamBody const):
3270         * Modules/fetch/FetchBodySource.cpp:
3271         * Modules/fetch/FetchBodySource.h:
3272         * Modules/fetch/FetchResponse.cpp:
3273         (WebCore::FetchResponse::consumeBodyFromReadableStream):
3274         (WebCore::FetchResponse::consumeBodyWhenLoaded):
3275         (WebCore::FetchResponse::consumeBodyAsStream):
3276         * Modules/fetch/FetchResponse.h:
3277         * Modules/fetch/FetchResponse.idl:
3278         * Modules/fetch/FetchResponse.js:
3279         (initializeFetchResponse):
3280         (clone):
3281         * bindings/js/ReadableStream.cpp:
3282         (WebCore::callFunction):
3283         (WebCore::ReadableStream::pipeTo):
3284         (WebCore::ReadableStream::tee):
3285         (WebCore::checkReadableStream):
3286         (WebCore::ReadableStream::isLocked const):
3287         (WebCore::ReadableStream::isDisturbed const):
3288         (WebCore::ReadableStream::isDisturbed):
3289         * bindings/js/ReadableStream.h:
3290         * bindings/js/ReadableStreamDefaultController.cpp:
3291         * bindings/js/ReadableStreamDefaultController.h:
3292         * bindings/js/WebCoreBuiltinNames.h:
3293         * testing/Internals.cpp:
3294         (WebCore::Internals::isReadableStreamDisturbed):
3295
3296 2017-09-06  Ryan Haddad  <ryanhaddad@apple.com>
3297
3298         Unreviewed, rolling out r221461.
3299
3300         The LayoutTest added with this change crashes under
3301         GuardMalloc.
3302
3303         Reverted changeset:
3304
3305         "Add (entirely incorrect) fetching of ServiceWorker scripts."
3306         https://bugs.webkit.org/show_bug.cgi?id=176179
3307         http://trac.webkit.org/changeset/221461
3308
3309 2017-09-06  Devin Rousso  <webkit@devinrousso.com>
3310
3311         Web Inspector: Support overloaded CanvasRenderingContext2D actions with identical parameter counts
3312         https://bugs.webkit.org/show_bug.cgi?id=176178
3313         <rdar://problem/34192229>
3314
3315         Reviewed by Matt Baker.
3316
3317         Update existing tests.
3318
3319         * WebCore.xcodeproj/project.pbxproj:
3320
3321         * inspector/InspectorCanvas.cpp:
3322         (WebCore::buildArrayForVector):
3323         (WebCore::InspectorCanvas::buildAction):
3324         Add another array to each action that contains a swizzle type for each parameter. This is
3325         used by the frontend to determine how to regenerate the value from what is given in the JSON.
3326
3327         * inspector/RecordingSwizzleTypes.h: Added.
3328         Contains a value-specified enum of types that translate into int values, which are mirrored
3329         by an object in the frontend, that indicate the type of each parameter. This enum matches
3330         the values in WI.Recording.Swizzle.
3331
3332 2017-09-06  Per Arne Vollan  <pvollan@apple.com>
3333
3334         [Win] WebCore failed to build, InbandTextTrackPrivateAVF: base class undefined.
3335         https://bugs.webkit.org/show_bug.cgi?id=176431
3336
3337         Reviewed by Alex Christensen.
3338
3339         AVFoundation header detection should be done in WebCore because of build dependencies.
3340
3341         No new tests, covered by existing tests.
3342
3343         * AVFoundationSupport.py: Copied from Source/WTF/AVFoundationSupport.py.
3344         * PlatformWin.cmake:
3345         * config.h:
3346         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3347         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
3348
3349 2017-09-06  Sam Weinig  <sam@webkit.org>
3350
3351         REGRESSION (r221598): Legacy "round" and "bevel" options can no longer be used with the legacy CanvasRenderingContext2D setLineJoin operation
3352         https://bugs.webkit.org/show_bug.cgi?id=176461
3353
3354         Reviewed by Alex Christensen.
3355
3356         Tests: fast/canvas/canvas-strokePath-cap-join-legacy-functions-match-attribute.html
3357                fast/canvas/canvas-strokePath-cap-join-legacy.html
3358
3359         * html/canvas/CanvasRenderingContext2D.cpp:
3360         (WebCore::CanvasRenderingContext2D::setLineJoin):
3361         
3362             Fix silly typo, ifs -> else ifs.
3363
3364 2017-09-06  Per Arne Vollan  <pvollan@apple.com>
3365
3366         [Win] Compile errors in Document::updateTitleElement.
3367         https://bugs.webkit.org/show_bug.cgi?id=176381
3368
3369         Reviewed by Alex Christensen.
3370
3371         MSVC is not able to compile the statement:
3372         'auto result = boolExpression ? lambda1 : lambda2;'
3373         where 'lambda1' and 'lambda2' have the same signature.
3374
3375         * dom/Document.cpp:
3376         (WebCore::findHTMLTitle):
3377         (WebCore::isHTMLTitle):
3378         (WebCore::isHTMLTitleEligible):
3379         (WebCore::findSVGTitle):
3380         (WebCore::isSVGTitle):
3381         (WebCore::isSVGTitleEligible):
3382         (WebCore::Document::updateTitleElement):
3383
3384 2017-09-06  Brent Fulgham  <bfulgham@apple.com>
3385
3386         Deny third-party cookie creation for prevalent resources without interaction
3387         https://bugs.webkit.org/show_bug.cgi?id=175232
3388         <rdar://problem/33709386>
3389
3390         Reviewed by Alex Christensen.
3391
3392         Prior to Intelligent Tracking Prevention, WebKit would deny the ability to create a third party cookie if the user's
3393         settings prohibited it. Due to the internal mechanics of cookie partitioning, we now accept the third party cookie,
3394         but destroy it at some arbitrary moment which is difficult for websites to work with.
3395         
3396         This patch revises WebKit so that attempts to set third party cookies without user interaction fails immediately,
3397         which is what sites are expecting from Safari.
3398
3399         Tests: http/tests/loading/resourceLoadStatistics/third-party-cookie-with-and-without-user-interaction.html
3400
3401         * platform/network/NetworkStorageSession.h:
3402         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3403         (WebCore::NetworkStorageSession::shouldPartitionCookies const): Revise for new naming.
3404         (WebCore::NetworkStorageSession::shouldAllowThirdPartyCookies const): Allow third party cookies when the
3405         user interaction property applies.
3406         (WebCore::NetworkStorageSession::shouldBlockCookies const): Deny cookies for origins that are not allowed by
3407</