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