Allow WTF::map to use any class that is iterable and has a size getter
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-09-19  Youenn Fablet  <youenn@apple.com>
2
3         Allow WTF::map to use any class that is iterable and has a size getter
4         https://bugs.webkit.org/show_bug.cgi?id=177026
5
6         Reviewed by Darin Adler.
7
8         No change of behavior.
9         Using WTF::map to go from maps to vectors.
10
11         * loader/appcache/ApplicationCacheHost.cpp:
12         (WebCore::ApplicationCacheHost::resourceList):
13         * page/DOMWindow.cpp:
14         (WebCore::DOMWindow::dispatchAllPendingUnloadEvents):
15
16 2017-09-19  Eric Carlson  <eric.carlson@apple.com>
17
18         Quiet media player private logging
19         https://bugs.webkit.org/show_bug.cgi?id=177199
20
21         Reviewed by Jer Noble.
22
23         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
24         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
25
26 2017-09-19  Alex Christensen  <achristensen@webkit.org>
27
28         Allow modern decoding of Vectors
29         https://bugs.webkit.org/show_bug.cgi?id=177102
30
31         Reviewed by Andy Estes.
32
33         * Modules/cache/DOMCacheEngine.h:
34         (WebCore::DOMCacheEngine::CacheInfos::decode):
35         (WebCore::DOMCacheEngine::CacheIdentifierOperationResult::decode):
36         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
37         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
38         * Modules/indexeddb/IDBDatabaseIdentifier.h:
39         (WebCore::IDBDatabaseIdentifier::decode):
40         * Modules/indexeddb/IDBFactory.cpp:
41         (WebCore::IDBFactory::openInternal):
42         (WebCore::IDBFactory::deleteDatabase):
43         * Modules/indexeddb/IDBGetAllResult.h:
44         (WebCore::IDBGetAllResult::decode):
45         * Modules/indexeddb/IDBGetResult.h:
46         (WebCore::IDBGetResult::decode):
47         * Modules/indexeddb/IDBKeyData.h:
48         (WebCore::IDBKeyData::decode):
49         * Modules/indexeddb/IDBKeyRangeData.h:
50         (WebCore::IDBKeyRangeData::decode):
51         * Modules/indexeddb/IDBValue.h:
52         (WebCore::IDBValue::decode):
53         * Modules/indexeddb/shared/IDBError.h:
54         * Modules/indexeddb/shared/IDBIterateCursorData.h:
55         (WebCore::IDBIterateCursorData::decode):
56         * Modules/indexeddb/shared/IDBRequestData.h:
57         (WebCore::IDBRequestData::decode):
58         * Modules/indexeddb/shared/IDBResultData.h:
59         (WebCore::IDBResultData::decode):
60         * page/SecurityOriginData.h:
61         (WebCore::SecurityOriginData::decode):
62         * platform/Cookie.h:
63         (WebCore::Cookie::decode):
64         * platform/mediastream/MediaConstraints.h:
65         (WebCore::MediaTrackConstraintSetMap::decode):
66         * platform/network/FormData.h:
67         (WebCore::FormDataElement::decode):
68         * workers/service/ServiceWorkerJobData.h:
69         (WebCore::ServiceWorkerJobData::decode):
70         * workers/service/ServiceWorkerRegistrationData.h:
71         (WebCore::ServiceWorkerRegistrationData::decode):
72         * workers/service/ServiceWorkerRegistrationKey.h:
73         (WebCore::ServiceWorkerRegistrationKey::decode):
74
75 2017-09-19  Ryosuke Niwa  <rniwa@webkit.org>
76
77         On iOS, getData can't get text set by setData during copy event
78         https://bugs.webkit.org/show_bug.cgi?id=176980
79         <rdar://problem/34453915>
80
81         Reviewed by Darin Adler.
82
83         The bug was caused by iOS port not implementing Pasteboard::createPrivate(). Rather than implementing this in iOS,
84         replace its use for copy & paste events by StaticPasteboard Wenson added for input events. This makes read-write
85         pasteboard platform agnostic and paves the way to make writing to pasteboard in a single IPC in WebKit2.
86
87         Also fixed a bug that iOS port's Pasteboard::types returned the list of all supported types instead of ones
88         actually present in the pasteboard.
89
90         This patch also adds a vector of types to StaticPasteboard to maintain the type order.
91
92         Tests: editing/pasteboard/dataTransfer-types-is-initially-empty-on-copy.html
93                editing/pasteboard/dataTransfer-types-pasting-plaintext.html
94
95         * dom/DataTransfer.cpp:
96         (WebCore::DataTransfer::createForCopyAndPaste): Make StaticPasteboard instead of a private pasteboard.
97         (WebCore::DataTransfer::createForInputEvent):
98         * editing/Editor.cpp:
99         (WebCore::dispatchClipboardEvent): Call newly added commitToPasteboard on StaticPasteboard.
100         * platform/Pasteboard.h:
101         (WebCore::Pasteboard::isStatic const):
102         * platform/PasteboardStrategy.h:
103         * platform/StaticPasteboard.cpp:
104         (WebCore::StaticPasteboard::create): Deleted.
105         (WebCore::StaticPasteboard::StaticPasteboard):
106         (WebCore::StaticPasteboard::hasData):
107         (WebCore::StaticPasteboard::types): Deleted. Now simply returns m_type.
108         (WebCore::StaticPasteboard::readString): Added.
109         (WebCore::StaticPasteboard::writeString): Added.
110         (WebCore::StaticPasteboard::clear): Added.
111         (WebCore::StaticPasteboard::commitToPasteboard): Added.
112         (isType): Added.
113         * platform/StaticPasteboard.h:
114         (WebCore::Pasteboard::isStatic const): Added.
115         * platform/gtk/PasteboardGtk.cpp:
116         (WebCore::Pasteboard::createPrivate): Deleted.
117         (WebCore::Pasteboard::writePasteboard): Deleted.
118         * platform/ios/PasteboardIOS.mm:
119         (WebCore::Pasteboard::createPrivate): Deleted.
120         (WebCore::Pasteboard::writePasteboard): Deleted.
121         (WebCore::addHTMLClipboardTypesForCocoaType):
122         (WebCore::Pasteboard::types): Return the actual list of types in the pasteboard.
123         * platform/mac/PasteboardMac.mm:
124         (WebCore::Pasteboard::createPrivate): Deleted.
125         (WebCore::Pasteboard::writePasteboard): Deleted.
126         * platform/win/PasteboardWin.cpp:
127         (WebCore::Pasteboard::createPrivate): Deleted.
128         (WebCore::Pasteboard::writePasteboard): Deleted.
129         * platform/wpe/PasteboardWPE.cpp:
130         (WebCore::Pasteboard::createPrivate): Deleted.
131         (WebCore::Pasteboard::writePasteboard): Deleted.
132
133 2017-09-19  Zalan Bujtas  <zalan@apple.com>
134
135         AXObjectCache::performDeferredCacheUpdate is called recursively through FrameView::layout. 
136         https://bugs.webkit.org/show_bug.cgi?id=176218
137         <rdar://problem/34205612>
138
139         Reviewed by Simon Fraser.
140
141         There are certain cases when we might re-enter performDeferredCacheUpdate through recursive
142         layout calls (see webkit.org/b/177176) and mutate m_deferredTextChangedList multiple times.
143
144         Test: accessibility/crash-table-recursive-layout.html
145
146         * accessibility/AXObjectCache.cpp:
147         (WebCore::AXObjectCache::performDeferredCacheUpdate):
148         * accessibility/AXObjectCache.h:
149
150 2017-09-19  Jer Noble  <jer.noble@apple.com>
151
152         [Cocoa] Add an ImageDecoder subclass backed by AVFoundation
153         https://bugs.webkit.org/show_bug.cgi?id=176825
154
155         Reviewed by Eric Carlson.
156
157         Add a new concrete subclass of ImageDecoder which uses AVFoundation to parse and decode
158         image data.
159
160         AVFoundation APIs require prior knowledge of the media data's mime type to determine whether
161         the media data is decodable, so the mime type information must be passed through from the
162         CachedResource -> CachedImage -> ImageFrameCache -> ImageSource so as to be available when
163         creating the ImageDecoder:
164
165         (Drive-by fix: the createFrameImageAtIndex() method will mutate internal state, so make it
166         non-const.)
167
168         * loader/cache/CachedImage.h:
169         * loader/cache/CachedResource.h:
170         (WebCore::CachedResource::mimeType const):
171         * platform/cf/CoreMediaSoftLink.cpp:
172         * platform/cf/CoreMediaSoftLink.h:
173         * platform/cocoa/VideoToolboxSoftLink.cpp:
174         * platform/cocoa/VideoToolboxSoftLink.h:
175         * platform/graphics/Image.cpp:
176         (WebCore::Image::mimeType const):
177         (WebCore::Image::expectedContentSize const):
178         * platform/graphics/Image.h:
179         * platform/graphics/ImageDecoder.cpp:
180         (WebCore::ImageDecoder::create):
181         * platform/graphics/ImageDecoder.h:
182         (WebCore::ImageDecoder::setExpectedContentSize):
183         * platform/graphics/ImageFrameCache.cpp:
184         (WebCore::ImageFrameCache::mimeType const):
185         * platform/graphics/ImageFrameCache.h:
186         * platform/graphics/ImageObserver.h:
187         * platform/graphics/ImageSource.cpp:
188         (WebCore::ImageSource::ensureDecoderAvailable):
189         * platform/graphics/cg/ImageDecoderCG.cpp:
190         (WebCore::ImageDecoderCG::createFrameImageAtIndex):
191         * platform/graphics/cg/ImageDecoderCG.h:
192
193         Add the new class, ImageDecoderAVFObjC:
194
195         AVFoundation expects to load all the media data for an AVURLAsset itself. To map between the
196         provided SharedData and AVURLAsset's requirements, create a delegate object
197         WebCoreSharedBufferResourceLoaderDelegate, which responds to requests from the AVURLAsset by
198         extracting data from the SharedData object. Ensure AVURLAsset doesn't load any data outside
199         this delegate by passing the AVURLAssetReferenceRestrictionsKey /
200         AVAssetReferenceRestrictionForbidAll key and value in the AVURLAsset creation options.
201
202         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h: Added.
203         (WebCore::ImageDecoderAVFObjC::create):
204         (WebCore::ImageDecoderAVFObjC::mimeType const):
205         (WebCore::ImageDecoderAVFObjC::RotationProperties::isIdentity const):
206         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: Added.
207         (SOFT_LINK_CONSTANT):
208         (-[WebCoreSharedBufferResourceLoaderDelegate initWithParent:]):
209         (-[WebCoreSharedBufferResourceLoaderDelegate setExpectedContentSize:]):
210         (-[WebCoreSharedBufferResourceLoaderDelegate updateData:complete:]):
211         (-[WebCoreSharedBufferResourceLoaderDelegate canFulfillRequest:]):
212         (-[WebCoreSharedBufferResourceLoaderDelegate enqueueRequest:]):
213         (-[WebCoreSharedBufferResourceLoaderDelegate fulfillPendingRequests]):
214         (-[WebCoreSharedBufferResourceLoaderDelegate fulfillRequest:]):
215         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
216         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:didCancelLoadingRequest:]):
217         (WebCore::customSchemeURL):
218         (WebCore::imageDecoderAssetOptions):
219         (WebCore::transformToRotationProperties):
220         (WebCore::ImageDecoderAVFObjC::ImageDecoderAVFObjC):
221         (WebCore::ImageDecoderAVFObjC::canDecodeType):
222         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack):
223         (WebCore::ImageDecoderAVFObjC::readSampleMetadata): Parses the media data using AVSampleCursor to walk
224             the media sample table, extracting frame presentation time, decode time, and duration.
225         (WebCore::ImageDecoderAVFObjC::readTrackMetadata): Reads the affine transform and size information from
226             the AVAssetTrack, and transforms the transform into a rotation value.
227         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Decompress the incoming sample data, optionally rotate
228             the output, and store the results in the sample data vector.
229         (WebCore::ImageDecoderAVFObjC::advanceCursor): Wrap around the end of the sample table.
230         (WebCore::ImageDecoderAVFObjC::setTrack): Reset all sample and track metadata.
231         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const): Retrieve from sample data.
232         (WebCore::ImageDecoderAVFObjC::frameCount const): Ditto.
233         (WebCore::ImageDecoderAVFObjC::repetitionCount const): Ditto.
234         (WebCore::ImageDecoderAVFObjC::uti const): Ditto.
235         (WebCore::ImageDecoderAVFObjC::filenameExtension const): Ditto.
236         (WebCore::ImageDecoderAVFObjC::frameSizeAtIndex const): Ditto.
237         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const): Ditto.
238         (WebCore::ImageDecoderAVFObjC::frameOrientationAtIndex const): Ditto.
239         (WebCore::ImageDecoderAVFObjC::frameDurationAtIndex const): Ditto.
240         (WebCore::ImageDecoderAVFObjC::frameHasAlphaAtIndex const): Ditto.
241         (WebCore::ImageDecoderAVFObjC::frameAllowSubsamplingAtIndex const): Ditto.
242         (WebCore::ImageDecoderAVFObjC::frameBytesAtIndex const): Ditto.
243         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex): If the sample data has already been
244             decompressed, return it. Otherwise, walk through the sample table decompressing frames
245             until the desired frame is decoded.
246         (WebCore::ImageDecoderAVFObjC::setData):
247         (WebCore::ImageDecoderAVFObjC::clearFrameBufferCache):
248
249         Modify WebCoreDecompressionSession so that it can emit frames which have been converted from
250         YUV -> RGB as part of the decode operation. Also, add a synchronous decoding operation
251         method, for use in ImageDecoderAVFObjC.
252
253         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
254         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureDecompressionSession):
255         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
256         (WebCore::WebCoreDecompressionSession::createOpenGL):
257         (WebCore::WebCoreDecompressionSession::createRGB):
258         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
259         (WebCore::WebCoreDecompressionSession::WebCoreDecompressionSession):
260         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
261         (WebCore::WebCoreDecompressionSession::decodeSample):
262         (WebCore::WebCoreDecompressionSession::decodeSampleSync):
263
264         Other changes:
265
266         * WebCore.xcodeproj/project.pbxproj: Add new files to project.
267         * platform/cocoa/VideoToolboxSoftLink.cpp: Add newly referenced methods.
268         * platform/cocoa/VideoToolboxSoftLink.h: Ditto.
269
270
271 2017-09-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
272
273         [Curl] Move Authentication related tasks into AuthenticationChallenge class
274         https://bugs.webkit.org/show_bug.cgi?id=177105
275
276         Currently those codes are in ResourceHandle or related companion. It will
277         be reused with NetworkLoadTask so that it should be separated from them.
278
279         Reviewed by Alex Christensen.
280
281         * platform/Curl.cmake:
282         * platform/network/curl/AuthenticationChallenge.h:
283         (WebCore::AuthenticationChallenge::AuthenticationChallenge): Deleted.
284         (WebCore::AuthenticationChallenge::authenticationClient const): Deleted.
285         (WebCore::AuthenticationChallenge::setAuthenticationClient): Deleted.
286         * platform/network/curl/AuthenticationChallengeCurl.cpp: Added.
287         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
288         (WebCore::AuthenticationChallenge::protectionSpaceServerTypeFromURI):
289         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
290         (WebCore::AuthenticationChallenge::removeLeadingAndTrailingQuotes):
291         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
292         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
293         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
294         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
295         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace): Deleted.
296         * platform/network/curl/ResourceHandleCurlDelegate.h:
297
298 2017-09-19  Zalan Bujtas  <zalan@apple.com>
299
300         Do not mutate RenderText content during layout.
301         https://bugs.webkit.org/show_bug.cgi?id=176219
302         <rdar://problem/34205724>
303
304         Reviewed by David Hyatt.
305
306         Update combined text when the style/content change as opposed to lazily, during layout.
307         -content mutation during layout might make the inline tree go out of sync.
308
309         Test: fast/text/international/dynamic-text-combine-crash.html
310
311         * rendering/RenderBlockFlow.cpp:
312         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
313         * rendering/RenderCombineText.cpp:
314         (WebCore::RenderCombineText::styleDidChange):
315         (WebCore::RenderCombineText::setRenderedText):
316         (WebCore::RenderCombineText::combineTextIfNeeded):
317         (WebCore::RenderCombineText::combineText): Deleted.
318         * rendering/RenderCombineText.h:
319         * rendering/RenderText.h:
320         * rendering/line/BreakingContext.h:
321         (WebCore::BreakingContext::handleText):
322         * rendering/line/LineBreaker.cpp:
323         (WebCore::LineBreaker::skipLeadingWhitespace):
324
325 2017-09-15  Wenson Hsieh  <wenson_hsieh@apple.com>
326
327         createMarkupInternal should protect its pointer to the Range's common ancestor
328         https://bugs.webkit.org/show_bug.cgi?id=177033
329         <rdar://problem/34265390>
330
331         Reviewed by Tim Horton.
332
333         Adds basic safeguarding to codepaths hit while executing an outdent command.
334
335         Test: editing/execCommand/outdent-with-media-query-listener-in-iframe.html
336
337         * editing/IndentOutdentCommand.cpp:
338         (WebCore::IndentOutdentCommand::outdentRegion):
339
340         Avoid an infinite loop if endOfCurrentParagraph is a null position.
341
342         * editing/markup.cpp:
343         (WebCore::createMarkupInternal):
344
345         Protect the raw pointer to the Range's common ancestor node.
346
347 2017-09-19  Ryan Haddad  <ryanhaddad@apple.com>
348
349         Unreviewed, rolling out r222217 and r222214.
350         This change introduced two LayoutTest failures.
351         https://bugs.webkit.org/show_bug.cgi?id=177026
352
353         * rendering/RenderBlockFlow.cpp:
354         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
355         * rendering/RenderCombineText.cpp:
356         (WebCore::RenderCombineText::styleDidChange):
357         (WebCore::RenderCombineText::setRenderedText):
358         (WebCore::RenderCombineText::combineText):
359         (WebCore::RenderCombineText::combineTextIfNeeded): Deleted.
360         * rendering/RenderCombineText.h:
361         * rendering/RenderText.cpp:
362         * rendering/RenderText.h:
363         * rendering/line/BreakingContext.h:
364         (WebCore::BreakingContext::handleText):
365         * rendering/line/LineBreaker.cpp:
366         (WebCore::LineBreaker::skipLeadingWhitespace):
367
368 2017-09-19  Zalan Bujtas  <zalan@apple.com>
369
370         Attempt to fix Linux build.
371
372         * rendering/RenderText.cpp:
373
374 2017-09-19  Zalan Bujtas  <zalan@apple.com>
375
376         Do not mutate RenderText content during layout.
377         https://bugs.webkit.org/show_bug.cgi?id=176219
378         <rdar://problem/34205724>
379
380         Reviewed by David Hyatt.
381
382         Update combined text when the style/content change as opposed to lazily, during layout.
383         -content mutation during layout might make the inline tree go out of sync.
384
385         Test: fast/text/international/dynamic-text-combine-crash.html
386
387         * rendering/RenderBlockFlow.cpp:
388         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
389         * rendering/RenderCombineText.cpp:
390         (WebCore::RenderCombineText::styleDidChange):
391         (WebCore::RenderCombineText::setRenderedText):
392         (WebCore::RenderCombineText::combineTextIfNeeded):
393         (WebCore::RenderCombineText::combineText): Deleted.
394         * rendering/RenderCombineText.h:
395         * rendering/RenderText.h:
396         * rendering/line/BreakingContext.h:
397         (WebCore::BreakingContext::handleText):
398         * rendering/line/LineBreaker.cpp:
399         (WebCore::LineBreaker::skipLeadingWhitespace):
400
401 2017-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
402
403         [GTK] The binding code of Media Source Extension of AudioTrack, VideoTrack and TextTrack is not generated
404         https://bugs.webkit.org/show_bug.cgi?id=174620
405
406         Reviewed by Michael Catanzaro.
407
408         Add AudioTrackMediaSource, VideoTrackMediaSource and TextTrackMediaSource IDL files in CMakeLists. Fix WPT test
409         that checks MSE interfaces. This test failed since webm is not supported for MSE in GTK port. PR already merged
410         in WPT repository.
411
412         Remove skipped test that is now passing in TestExpectation. Modify expected file for GTK (same as mac).
413
414         * CMakeLists.txt:
415
416 2017-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
417
418         [Harfbuzz] adjustSelectionRectForComplexText() should also pass the character range when shaping
419         https://bugs.webkit.org/show_bug.cgi?id=177049
420
421         Reviewed by Michael Catanzaro.
422
423         Now that the shaper support receiving a range we should use that also in
424         adjustSelectionRectForComplexText(). This will ensure consistent results with
425         getGlyphsAndAdvancesForComplexText().
426
427         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
428         (WebCore::FontCascade::adjustSelectionRectForComplexText const):
429
430 2017-09-19  Dean Jackson  <dino@apple.com>
431
432         [WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
433         https://bugs.webkit.org/show_bug.cgi?id=176771
434         <rdar://problem/34386621>
435
436         Reviewed by Antoine Quint.
437
438         The OpenGL context in VideoTextureCopierCV wasn't being restored to
439         the state it had before rendering a video to a texture. Specifically
440         the vertex attribute values were never recorded by the state saver.
441
442         Update the existing test of VideoTextureCopierCV so that it is
443         explicitly doing something different from the WebCore code, which
444         means that state will have to be correctly restored for the test
445         to pass.
446
447         * platform/graphics/cv/VideoTextureCopierCV.cpp:
448         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Make sure
449         to record the vertex attribute state once we know the location of the position attribute.
450         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
451         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
452         (WebCore::VideoTextureCopierCV::GC3DStateSaver::saveVertexAttribState): Save all the
453         applicable vertex attribute state information.
454         * platform/graphics/cv/VideoTextureCopierCV.h: GC3DStateSaver can use a reference
455         to the GC3D rather than a pointer.
456
457 2017-09-19  Dean Jackson  <dino@apple.com>
458
459         [WebGL] accelerated texImage2D for video doesn't respect flipY
460         https://bugs.webkit.org/show_bug.cgi?id=176491
461         <rdar://problem/33833511>
462
463         Reviewed by Jer Noble.
464
465         (Take 3 - this was rolled out due to a test failure)
466
467         Previously, if UNPACK_FLIP_Y_WEBGL was set to true, we'd either fall
468         back to software or fail to upload texture data. Fix this by intercepting
469         the texImage2D call, checking the orientation of the video, and running
470         a small shader program to flip it if necessary.
471
472         While there, implement UNPACK_PREMULTIPLY_ALPHA_WEBGL as well, although
473         none of our media decoders support video with alpha, so unfortunately
474         this will have no visible change.
475
476         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
477                fast/canvas/webgl/texImage2D-video-flipY-true.html
478
479         * platform/cocoa/CoreVideoSoftLink.cpp: Add link to CVOpenGL(ES)TextureGetCleanTexCoords,
480         which is used to check the orientation of the source video.
481         * platform/cocoa/CoreVideoSoftLink.h:
482
483         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
484         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): We can
485         now handle flipped or premultiplied requests.
486         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
487         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): Ditto.
488
489         * platform/graphics/cv/VideoTextureCopierCV.cpp:
490         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): Rename readFramebuffer to
491         simply framebuffer.
492         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): Delete the program and buffer
493         if they were created.
494         (WebCore::VideoTextureCopierCV::initializeContextObjects): Sets up the shader program
495         and the vertex buffer for drawing. Also records the location of the uniforms.
496         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Create a new
497         framebuffer object, and render the video texture into that framebuffer using a
498         shader that can flip the coordinates.
499         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): Helper to restore
500         the state of the user's GraphicsContext3D while we're intercepting calls.
501         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
502         * platform/graphics/cv/VideoTextureCopierCV.h:
503
504         * platform/graphics/GraphicsContext3D.h: Add two new entry points, for direct shader
505         compilation and attribute access. This avoids going through ANGLE.
506         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
507         (WebCore::GraphicsContext3D::compileShader):
508         (WebCore::GraphicsContext3D::compileShaderDirect):
509         (WebCore::GraphicsContext3D::getAttribLocationDirect):
510
511 2017-09-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
512
513         Make ImageFrame::duration() return Seconds instead of float
514         https://bugs.webkit.org/show_bug.cgi?id=177103
515
516         Reviewed by Simon Fraser.
517
518         ScalableImageDecoder stores milliseconds for the duration of its ImageFrames.
519         But ImageFrameCache store seconds for the duration of its ImageFrames.
520         To fix this issue use Seconds for the ImageFrame duration.
521
522         * platform/graphics/BitmapImage.h:
523         * platform/graphics/ImageDecoder.h:
524         * platform/graphics/ImageFrame.h:
525         (WebCore::ImageFrame::setDuration):
526         (WebCore::ImageFrame::duration const):
527         * platform/graphics/ImageFrameCache.cpp:
528         (WebCore::ImageFrameCache::frameDurationAtIndex):
529         * platform/graphics/ImageFrameCache.h:
530         * platform/graphics/ImageSource.h:
531         (WebCore::ImageSource::frameDurationAtIndex):
532         * platform/graphics/cg/ImageDecoderCG.cpp:
533         (WebCore::ImageDecoderCG::frameDurationAtIndex const):
534         * platform/graphics/cg/ImageDecoderCG.h:
535         * platform/image-decoders/ScalableImageDecoder.cpp:
536         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
537         * platform/image-decoders/ScalableImageDecoder.h:
538         * platform/image-decoders/gif/GIFImageDecoder.cpp:
539         (WebCore::GIFImageDecoder::frameComplete):
540         * platform/image-decoders/png/PNGImageDecoder.cpp:
541         (WebCore::PNGImageDecoder::readChunks):
542         (WebCore::PNGImageDecoder::frameHeader): Deleted.
543         (WebCore::PNGImageDecoder::init): Deleted.
544         (WebCore::PNGImageDecoder::clearFrameBufferCache): Deleted.
545         (WebCore::PNGImageDecoder::initFrameBuffer): Deleted.
546         (WebCore::PNGImageDecoder::frameComplete): Deleted.
547         (WebCore::PNGImageDecoder::processingStart): Deleted.
548         (WebCore::PNGImageDecoder::processingFinish): Deleted.
549         (WebCore::PNGImageDecoder::fallbackNotAnimated): Deleted.
550
551 2017-09-18  Per Arne Vollan  <pvollan@apple.com>
552
553         [Win] Compile error in InbandTextTrackPrivateAVCF::readNativeSampleBuffer.
554         https://bugs.webkit.org/show_bug.cgi?id=177108
555
556         Reviewed by Brent Fulgham.
557
558         The InbandTextTrackPrivateAVF::m_sampleInputBuffer is private and not accessible in this method.
559  
560         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
561
562 2017-09-18  Tim Horton  <timothy_horton@apple.com>
563
564         Support min() and max() in calc()
565         https://bugs.webkit.org/show_bug.cgi?id=167000
566         <rdar://problem/30153481>
567
568         Reviewed by David Hyatt.
569         Patch originally by Myles Maxfield.
570
571         Add two new toplevel functions to CSS, min() and max(), which take an
572         arbirary number of arguments and resolve to the minimum and maximum of
573         the resolved value of the arguments, respectively. It is also possible
574         to use min() and max() inside calc(), and to use calc()-like math
575         inside min() and max().
576
577         * css/CSSCalculationValue.cpp:
578         (WebCore::determineCategory):
579         min and max operators don't use determineCategory; we have a specific
580         implementation for them in createMinOrMax.
581
582         (WebCore::resolvedTypeForMinOrMax):
583         The spec says that min() and max() should be marked as invalid if they
584         have values of more than one type, but that percentages should resolve
585         against the destination type before making this determination. So,
586         if the destination type is length, percent turns into percent-length,
587         and similarly for number.
588
589         (WebCore::isIntegerResult):
590         Add an n-way implementation of isIntegerResult.
591
592         (WebCore::isSamePair):
593         (WebCore::CSSCalcOperation::createMinOrMax): Create a min() or max()
594         operation, as long as the types of arguments are all the same. Allow
595         lengths to upgrade the whole operation to percent-length, and numbers
596         to percent-number, which will cause us to use CalculationValue and friends
597         in order to do proper resolution of all of the parameters instead of
598         just comparing their numeric values.
599
600         (WebCore::CSSCalcOperation::createCalcExpression):
601         (WebCore::CSSCalcOperation::doubleValue):
602         (WebCore::CSSCalcOperation::computeLengthPx):
603         (WebCore::CSSCalcOperation::customCSSText):
604         (WebCore::CSSCalcOperation::primitiveType):
605         (WebCore::CSSCalcOperation::CSSCalcOperation):
606         (WebCore::CSSCalcOperation::evaluate):
607         (WebCore::CSSCalcOperation::evaluateOperator):
608         Adapt to child counts greater than two.
609
610         (WebCore::CSSCalcOperation::buildCssText):
611         Add support for min() and max().
612
613         (WebCore::CSSCalcExpressionNodeParser::parseCalc):
614         parseCalc now accepts a CSSValueID parameter indicating which calc function
615         it should parse (calc, webkit-calc, min, or max), and delegates to either
616         parseValueExpression or parseMinMaxExpression.
617
618         (WebCore::CSSCalcExpressionNodeParser::operatorValue):
619         (WebCore::CSSCalcExpressionNodeParser::parseValue):
620         If min() or max() are found while parsing a value (i.e. nested inside
621         either calc or themselves), use parseMinMaxExpression on that subtree.
622
623         (WebCore::CSSCalcExpressionNodeParser::parseValueTerm):
624         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
625         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
626         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
627
628         (WebCore::CSSCalcExpressionNodeParser::parseMinMaxExpression):
629         Added. Parse an arbitrary number of comma-and-whitespace-separated children.
630
631         (WebCore::createBlendHalf):
632         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
633
634         (WebCore::createCSS):
635         Build the CSSCalcOperation for the platform-independent min and max operations.
636
637         (WebCore::CSSCalcValue::create):
638         Pass the function being parsed and the destination calc category for the
639         property being parsed for into create, and then into the parser so that
640         it can know which function it is parsing for, and what kind of result it
641         needs (as previously mentioned above in resolvedTypeForMinOrMax).
642
643         * css/CSSCalculationValue.h:
644         * css/CSSValueKeywords.in:
645         Add min and max functions as CSS keywords.
646
647         * css/StyleBuilderConverter.h:
648         (WebCore::StyleBuilderConverter::convertLength):
649         (WebCore::StyleBuilderConverter::convertTo100PercentMinusLength):
650         * platform/Length.cpp:
651         (WebCore::convertTo100PercentMinusLength):
652         Adapt to the CalcExpressionOperation constructor taking a vector of
653         arguments instead of two.
654
655         * css/parser/CSSPropertyParserHelpers.cpp:
656         (WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
657         Store and pass the specific function being parsed down into CSSCalcValue.
658
659         (WebCore::CSSPropertyParserHelpers::consumeInteger):
660         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
661         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
662         (WebCore::CSSPropertyParserHelpers::consumeNumber):
663         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
664         (WebCore::CSSPropertyParserHelpers::consumeLength):
665         (WebCore::CSSPropertyParserHelpers::consumePercent):
666         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
667         (WebCore::CSSPropertyParserHelpers::consumeAngle):
668         (WebCore::CSSPropertyParserHelpers::consumeTime):
669         Pass the destination type into each calc parser.
670
671         * platform/CalculationValue.cpp:
672         (WebCore::CalcExpressionOperation::evaluate const):
673         (WebCore::CalcExpressionOperation::operator== const):
674         (WebCore::CalcExpressionOperation::dump const):
675         (WebCore::operator<<):
676         (WebCore::CalcExpressionBinaryOperation::evaluate const): Deleted.
677         (WebCore::CalcExpressionBinaryOperation::operator== const): Deleted.
678         (WebCore::CalcExpressionBinaryOperation::dump const): Deleted.
679         * platform/CalculationValue.h:
680         (WebCore::CalcExpressionOperation::CalcExpressionOperation):
681         (WebCore::operator==):
682         (WebCore::toCalcExpressionOperation):
683         (WebCore::CalcExpressionBinaryOperation::CalcExpressionBinaryOperation): Deleted.
684         (WebCore::toCalcExpressionBinaryOperation): Deleted.
685         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
686         Adjust to having n>2 children.
687         Support min() and max() operators in various places.
688         
689
690 2017-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
691
692         [Curl] Move error generation task into ResourceError
693         https://bugs.webkit.org/show_bug.cgi?id=176963
694
695         Reviewed by Alex Christensen.
696
697         * platform/Curl.cmake:
698         * platform/network/curl/CurlContext.cpp:
699         (WebCore::CurlHandle::errorDescription):
700         (WebCore::CurlHandle::errorDescription const):
701         * platform/network/curl/CurlContext.h:
702         * platform/network/curl/ResourceError.h:
703         (WebCore::ResourceError::setSslErrors):
704         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
705         (WebCore::ResourceError::doPlatformIsolatedCopy): Deleted.
706         * platform/network/curl/ResourceErrorCurl.cpp: Added.
707         (WebCore::ResourceError::httpError):
708         (WebCore::ResourceError::sslError):
709         (WebCore::ResourceError::hasSSLConnectError const):
710         (WebCore::ResourceError::doPlatformIsolatedCopy):
711         (WebCore::ResourceError::platformCompare):
712         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
713         (WebCore::ResourceHandleCurlDelegate::notifyFail):
714         (WebCore::ResourceHandleCurlDelegate::didFail):
715         * platform/network/curl/ResourceHandleCurlDelegate.h:
716
717 2017-09-18  Ryan Haddad  <ryanhaddad@apple.com>
718
719         Unreviewed, rolling out r222170.
720
721         The API test added with this change is failing.
722
723         Reverted changeset:
724
725         "Allow WTF::map to use any class that is iterable and has a
726         size getter"
727         https://bugs.webkit.org/show_bug.cgi?id=177026
728         http://trac.webkit.org/changeset/222170
729
730 2017-09-18  Don Olmstead  <don.olmstead@sony.com>
731
732         [Curl] Forward declare SSL context
733
734         Unreviewed build fix after r222147. OpenSSL's SHA1 declaration conflicts with WTF's.
735
736         No new tests. No change in behavior.
737
738         * platform/network/curl/CurlSSLHandle.h:
739         * platform/network/curl/CurlSSLVerifier.cpp:
740         * platform/network/curl/CurlSSLVerifier.h:
741
742 2017-09-18  Ryosuke Niwa  <rniwa@webkit.org>
743
744         getData('text/plain') doesn't work on iOS 10
745         https://bugs.webkit.org/show_bug.cgi?id=177034
746
747         Reviewed by Wenson Hsieh.
748
749         The bug was caused by the mispatch of UTI between reading & writing plain text.
750         Use kUTTypeText (instead of kUTTypePlainText) to read from UIPasteboard on iOS 10.
751
752         Re-enabled tests were passing on iOS 11 and continues to pass after this code change.
753
754         Tests: editing/pasteboard/clipboard-event.html
755                editing/pasteboard/datatransfer-items-paste-plaintext.html
756                editing/pasteboard/get-data-text-plain-paste.html
757
758         * platform/ios/PasteboardIOS.mm:
759         (WebCore::cocoaTypeFromHTMLClipboardType):
760
761 2017-09-18  Youenn Fablet  <youenn@apple.com>
762
763         Allow WTF::map to use any class that is iterable and has a size getter
764         https://bugs.webkit.org/show_bug.cgi?id=177026
765
766         Reviewed by Darin Adler.
767
768         No change of behavior.
769         Using WTF::map to go from maps to vectors.
770
771         * loader/appcache/ApplicationCacheHost.cpp:
772         (WebCore::ApplicationCacheHost::resourceList):
773         * page/DOMWindow.cpp:
774         (WebCore::DOMWindow::dispatchAllPendingUnloadEvents):
775
776 2017-09-18  Emilio Cobos Ãlvarez  <emilio@crisal.io>
777
778         Always update display: contents styles in RenderTreeUpdater.
779         https://bugs.webkit.org/show_bug.cgi?id=177065
780
781         Reviewed by Antti Koivisto.
782
783         Otherwise we keep an old style around, making following style updates wrong.
784
785         Test: fast/css/display-contents-style-update.html
786
787         * style/RenderTreeUpdater.cpp:
788         (WebCore::RenderTreeUpdater::updateElementRenderer):
789
790 2017-09-18  Antti Koivisto  <antti@apple.com>
791
792         Avoid style resolution when clearing focused element.
793         https://bugs.webkit.org/show_bug.cgi?id=176224
794         <rdar://problem/34206409>
795
796         Reviewed by Zalan Bujtas.
797
798         Test: fast/dom/focus-style-resolution.html
799
800         * dom/Document.cpp:
801         (WebCore::Document::setFocusedElement):
802
803             Don't do synchronous style resolution with FocusRemovalEventsMode::DoNotDispatch.
804             Style resolution may dispatch events.
805
806         * html/HTMLInputElement.cpp:
807         (WebCore::HTMLInputElement::didBlur):
808
809             Move resolveStyleIfNeeded call to setFocusedElement. It is the only client for didBlur.
810
811 2017-09-18  Antti Koivisto  <antti@apple.com>
812
813         Rolling out the previous to land again with a test.
814
815         * dom/Document.cpp:
816         (WebCore::Document::setFocusedElement):
817         * html/HTMLInputElement.cpp:
818         (WebCore::HTMLInputElement::didBlur):
819
820 2017-09-18  Antti Koivisto  <antti@apple.com>
821
822         Avoid style resolution when clearing focused element.
823         https://bugs.webkit.org/show_bug.cgi?id=176224
824         <rdar://problem/34206409>
825
826         Reviewed by Zalan Bujtas.
827
828         Test: fast/dom/focus-style-resolution.html
829
830         * dom/Document.cpp:
831         (WebCore::Document::setFocusedElement):
832
833             Don't do synchronous style resolution with FocusRemovalEventsMode::DoNotDispatch.
834             Style resolution may dispatch events.
835
836         * html/HTMLInputElement.cpp:
837         (WebCore::HTMLInputElement::didBlur):
838
839             Move resolveStyleIfNeeded call to setFocusedElement. It is the only client for didBlur.
840
841 2017-09-18  Per Arne Vollan  <pvollan@apple.com>
842
843         [WK1] Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing.
844         https://bugs.webkit.org/show_bug.cgi?id=177071
845
846         Reviewed by Brent Fulgham.
847
848         The Page pointer in the history controller's frame is null. Add a null pointer check before
849         accessing the page. 
850
851         No new tests, covered by exiting tests.
852
853         * loader/HistoryController.cpp:
854         (WebCore::HistoryController::updateForStandardLoad):
855         (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
856         (WebCore::HistoryController::updateForClientRedirect):
857
858 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
859
860         REGRESSION(r221974): [Harfbuzz] Test fast/text/international/hebrew-selection.html is failing since r221974
861         https://bugs.webkit.org/show_bug.cgi?id=177036
862
863         Reviewed by Michael Catanzaro.
864
865         In r221974 I rewrote the characterIndexForXPosition implementation without taking into account that there can be
866         multiple glyphs for the same character, so we can't simply do index++ and index-- to get the next and previous
867         character index.
868
869         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
870         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition): Always get the character index from
871         m_glyphToCharacterIndexes array.
872
873 2017-09-18  Jer Noble  <jer.noble@apple.com>
874
875         Virtualize ImageDecoder
876         https://bugs.webkit.org/show_bug.cgi?id=176118
877
878         Reviewed by Eric Carlson.
879
880         Add an explicit, abstract base class ImageDecoder, and convert ImageDecoderCG to a true
881         subclass. This will allow multiple ImageDecoder subclasses to exist simultaneously at
882         runtime.
883
884         * CMakeLists.txt:
885         * WebCore.xcodeproj/project.pbxproj:
886         * platform/ImageDecoders.cmake:
887         * platform/graphics/ImageDecoder.cpp: Added.
888         (WebCore::ImageDecoder::create):
889         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties):
890         * platform/graphics/ImageDecoder.h: Added.
891         (WebCore::ImageDecoder::isSizeAvailable):
892         (WebCore::ImageDecoder::isAllDataReceived const):
893         * platform/graphics/cg/ImageDecoderCG.cpp:
894         (WebCore::ImageDecoderCG::ImageDecoderCG):
895         (WebCore::ImageDecoderCG::bytesDecodedToDetermineProperties):
896         (WebCore::ImageDecoderCG::uti const):
897         (WebCore::ImageDecoderCG::filenameExtension const):
898         (WebCore::ImageDecoderCG::encodedDataStatus const):
899         (WebCore::ImageDecoderCG::frameCount const):
900         (WebCore::ImageDecoderCG::repetitionCount const):
901         (WebCore::ImageDecoderCG::hotSpot const):
902         (WebCore::ImageDecoderCG::frameSizeAtIndex const):
903         (WebCore::ImageDecoderCG::frameIsCompleteAtIndex const):
904         (WebCore::ImageDecoderCG::frameOrientationAtIndex const):
905         (WebCore::ImageDecoderCG::frameDurationAtIndex const):
906         (WebCore::ImageDecoderCG::frameAllowSubsamplingAtIndex const):
907         (WebCore::ImageDecoderCG::frameHasAlphaAtIndex const):
908         (WebCore::ImageDecoderCG::frameBytesAtIndex const):
909         (WebCore::ImageDecoderCG::createFrameImageAtIndex const):
910         (WebCore::ImageDecoderCG::setData):
911         (WebCore::ImageDecoder::ImageDecoder): Deleted.
912         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties): Deleted.
913         (WebCore::ImageDecoder::uti const): Deleted.
914         (WebCore::ImageDecoder::filenameExtension const): Deleted.
915         (WebCore::ImageDecoder::encodedDataStatus const): Deleted.
916         (WebCore::ImageDecoder::frameCount const): Deleted.
917         (WebCore::ImageDecoder::repetitionCount const): Deleted.
918         (WebCore::ImageDecoder::hotSpot const): Deleted.
919         (WebCore::ImageDecoder::frameSizeAtIndex const): Deleted.
920         (WebCore::ImageDecoder::frameIsCompleteAtIndex const): Deleted.
921         (WebCore::ImageDecoder::frameOrientationAtIndex const): Deleted.
922         (WebCore::ImageDecoder::frameDurationAtIndex const): Deleted.
923         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex const): Deleted.
924         (WebCore::ImageDecoder::frameHasAlphaAtIndex const): Deleted.
925         (WebCore::ImageDecoder::frameBytesAtIndex const): Deleted.
926         (WebCore::ImageDecoder::createFrameImageAtIndex const): Deleted.
927         (WebCore::ImageDecoder::setData): Deleted.
928         * platform/graphics/cg/ImageDecoderCG.h:
929         (WebCore::ImageDecoderCG::create):
930         (WebCore::ImageDecoder::create): Deleted.
931         (WebCore::ImageDecoder::isSizeAvailable): Deleted.
932         (WebCore::ImageDecoder::isAllDataReceived const): Deleted.
933         (WebCore::ImageDecoder::clearFrameBufferCache): Deleted.
934         * platform/graphics/win/ImageDecoderDirect2D.cpp:
935         (WebCore::ImageDecoderDirect2D::ImageDecoderDirect2D):
936         (WebCore::ImageDecoderDirect2D::systemImagingFactory):
937         (WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties):
938         (WebCore::ImageDecoderDirect2D::filenameExtension const):
939         (WebCore::ImageDecoderDirect2D::isSizeAvailable const):
940         (WebCore::ImageDecoderDirect2D::encodedDataStatus const):
941         (WebCore::ImageDecoderDirect2D::size const):
942         (WebCore::ImageDecoderDirect2D::frameCount const):
943         (WebCore::ImageDecoderDirect2D::repetitionCount const):
944         (WebCore::ImageDecoderDirect2D::hotSpot const):
945         (WebCore::ImageDecoderDirect2D::frameSizeAtIndex const):
946         (WebCore::ImageDecoderDirect2D::frameIsCompleteAtIndex const):
947         (WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
948         (WebCore::ImageDecoderDirect2D::frameDurationAtIndex const):
949         (WebCore::ImageDecoderDirect2D::frameAllowSubsamplingAtIndex const):
950         (WebCore::ImageDecoderDirect2D::frameHasAlphaAtIndex const):
951         (WebCore::ImageDecoderDirect2D::frameBytesAtIndex const):
952         (WebCore::ImageDecoderDirect2D::setTargetContext):
953         (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex const):
954         (WebCore::ImageDecoderDirect2D::setData):
955         * platform/graphics/win/ImageDecoderDirect2D.h:
956         (WebCore::ImageDecoderDirect2D::create):
957         (WebCore::ImageDecoder::create): Deleted.
958         (WebCore::ImageDecoder::isAllDataReceived const): Deleted.
959         (WebCore::ImageDecoder::clearFrameBufferCache): Deleted.
960         * platform/image-decoders/ScalableImageDecoder.cpp: Renamed from Source/WebCore/platform/image-decoders/ImageDecoder.cpp.
961         (WebCore::ScalableImageDecoder::create):
962         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
963         (WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const):
964         (WebCore::ScalableImageDecoder::frameBytesAtIndex const):
965         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
966         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
967         (WebCore::ScalableImageDecoder::prepareScaleDataIfNecessary):
968         (WebCore::ScalableImageDecoder::upperBoundScaledX):
969         (WebCore::ScalableImageDecoder::lowerBoundScaledX):
970         (WebCore::ScalableImageDecoder::upperBoundScaledY):
971         (WebCore::ScalableImageDecoder::lowerBoundScaledY):
972         (WebCore::ScalableImageDecoder::scaledY):
973         * platform/image-decoders/ScalableImageDecoder.h: Renamed from Source/WebCore/platform/image-decoders/ImageDecoder.h.
974         (WebCore::ScalableImageDecoder::ScalableImageDecoder):
975         (WebCore::ScalableImageDecoder::~ScalableImageDecoder):
976         (WebCore::ScalableImageDecoder::premultiplyAlpha const):
977         (WebCore::ScalableImageDecoder::isAllDataReceived const):
978         (WebCore::ScalableImageDecoder::size const):
979         (WebCore::ScalableImageDecoder::scaledSize):
980         (WebCore::ScalableImageDecoder::setSize):
981         (WebCore::ScalableImageDecoder::setIgnoreGammaAndColorProfile):
982         (WebCore::ScalableImageDecoder::ignoresGammaAndColorProfile const):
983         (WebCore::ScalableImageDecoder::rgbColorProfile):
984         (WebCore::ScalableImageDecoder::subsamplingLevelForScale):
985         (WebCore::ScalableImageDecoder::inputDeviceColorProfile):
986         (WebCore::ScalableImageDecoder::setFailed):
987         (WebCore::ScalableImageDecoder::failed const):
988         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
989         (WebCore::BMPImageDecoder::BMPImageDecoder):
990         (WebCore::BMPImageDecoder::setData):
991         (WebCore::BMPImageDecoder::setFailed):
992         * platform/image-decoders/bmp/BMPImageDecoder.h:
993         * platform/image-decoders/bmp/BMPImageReader.h:
994         * platform/image-decoders/gif/GIFImageDecoder.cpp:
995         (WebCore::GIFImageDecoder::GIFImageDecoder):
996         (WebCore::GIFImageDecoder::setData):
997         (WebCore::GIFImageDecoder::setSize):
998         (WebCore::GIFImageDecoder::setFailed):
999         * platform/image-decoders/gif/GIFImageDecoder.h:
1000         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1001         (WebCore::ICOImageDecoder::ICOImageDecoder):
1002         (WebCore::ICOImageDecoder::setData):
1003         (WebCore::ICOImageDecoder::size):
1004         (WebCore::ICOImageDecoder::setSize):
1005         (WebCore::ICOImageDecoder::setFailed):
1006         * platform/image-decoders/ico/ICOImageDecoder.h:
1007         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1008         (WebCore::JPEGImageDecoder::JPEGImageDecoder):
1009         (WebCore::JPEGImageDecoder::setSize):
1010         (WebCore::JPEGImageDecoder::setFailed):
1011         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
1012         * platform/image-decoders/png/PNGImageDecoder.cpp:
1013         (WebCore::PNGImageReader::decode):
1014         (WebCore::PNGImageDecoder::PNGImageDecoder):
1015         (WebCore::PNGImageDecoder::setSize):
1016         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1017         (WebCore::PNGImageDecoder::setFailed):
1018         * platform/image-decoders/png/PNGImageDecoder.h:
1019         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1020         (WebCore::WEBPImageDecoder::WEBPImageDecoder):
1021         (WebCore::WEBPImageDecoder::decode):
1022         * platform/image-decoders/webp/WEBPImageDecoder.h:
1023
1024 2017-09-18  Andy Estes  <aestes@apple.com>
1025
1026         [Mac] Upstream miscellaneous WebKitSystemInterface functions
1027         https://bugs.webkit.org/show_bug.cgi?id=177029
1028
1029         Reviewed by Alex Christensen.
1030
1031         * Configurations/WebCore.xcconfig: Used -force_load of libPAL instead of -ObjC. This forces
1032         the linker to load both Objective-C and C PAL symbols in WebCore. This change is needed for
1033         PAL::popUpMenu(), which is used by WebKit and WebKitLegacy but not WebCore.
1034         * platform/cocoa/LocalizedStringsCocoa.mm:
1035         (WebCore::contextMenuItemTagSearchWeb):
1036         * platform/cocoa/ScrollController.mm:
1037         (WebCore::elasticDeltaForTimeDelta):
1038         (WebCore::elasticDeltaForReboundDelta):
1039         (WebCore::reboundDeltaForElasticDelta):
1040         * platform/graphics/ca/GraphicsLayerCA.cpp:
1041         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1042         * platform/mac/CursorMac.mm:
1043         (WebCore::WKCoreCursor_coreCursorType):
1044         (WebCore::createCoreCursorClass):
1045         (WebCore::coreCursorClass):
1046         (WebCore::cursor):
1047         (WebCore::Cursor::ensurePlatformCursor const):
1048         * platform/mac/WebCoreSystemInterface.h:
1049         * platform/mac/WebCoreSystemInterface.mm:
1050         * rendering/RenderThemeMac.mm:
1051         (WebCore::RenderThemeMac::paintTextArea):
1052
1053 2017-09-18  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1054
1055         [Win][PAL] Move WebCoreHeaderDetection.h to PAL
1056         https://bugs.webkit.org/show_bug.cgi?id=176990
1057
1058         Reviewed by Alex Christensen.
1059
1060         * PlatformWin.cmake:
1061         Stop generating WebCoreHeaderDetection.h in WebCore.
1062
1063         * config.h:
1064         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1065         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
1066         Include PALHeaderDetection.h instead of WebCoreHeaderDetection.h
1067
1068 2017-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1069
1070         [Curl] Create classes dedicated to handle SSL related tasks
1071         and separate verifier and certificate management.
1072         https://bugs.webkit.org/show_bug.cgi?id=176910
1073
1074         Reviewed by Alex Christensen.
1075
1076         * platform/Curl.cmake:
1077         * platform/network/curl/CurlContext.cpp:
1078         (WebCore::CurlContext::CurlContext):
1079         (WebCore::CurlHandle::setCACertPath):
1080         (WebCore::certificatePath): Deleted.
1081         (WebCore::CurlHandle::enableCAInfoIfExists): Deleted.
1082         (WebCore::CurlHandle::setSslErrors): Deleted.
1083         (WebCore::CurlHandle::getSslErrors): Deleted.
1084         * platform/network/curl/CurlContext.h:
1085         (WebCore::CurlContext::sslHandle):
1086         (WebCore::CurlContext::getCertificatePath const): Deleted.
1087         (WebCore::CurlContext::shouldIgnoreSSLErrors const): Deleted.
1088         * platform/network/curl/CurlDownload.cpp:
1089         (WebCore::CurlDownload::setupRequest):
1090         * platform/network/curl/CurlSSLHandle.cpp: Added.
1091         (WebCore::CurlSSLHandle::CurlSSLHandle):
1092         (WebCore::CurlSSLHandle::getCACertPathEnv):
1093         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
1094         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost):
1095         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
1096         (WebCore::CurlSSLHandle::setClientCertificateInfo):
1097         (WebCore::CurlSSLHandle::getSSLClientCertificate):
1098         * platform/network/curl/CurlSSLHandle.h: Renamed from Source/WebCore/platform/network/curl/SSLHandle.h.
1099         (WebCore::CurlSSLHandle::shouldIgnoreSSLErrors const):
1100         (WebCore::CurlSSLHandle::getCACertPath const):
1101         * platform/network/curl/CurlSSLVerifier.cpp: Renamed from Source/WebCore/platform/network/curl/SSLHandle.cpp.
1102         (WebCore::CurlSSLVerifier::setSslCtx):
1103         (WebCore::CurlSSLVerifier::certVerifyCallback):
1104         (WebCore::CurlSSLVerifier::getPemDataFromCtx):
1105         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags):
1106         * platform/network/curl/CurlSSLVerifier.h: Added.
1107         (WebCore::CurlSSLVerifier::setCurlHandle):
1108         (WebCore::CurlSSLVerifier::setHostName):
1109         (WebCore::CurlSSLVerifier::sslErrors):
1110         * platform/network/curl/ResourceHandleCurl.cpp:
1111         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate):
1112         (WebCore::ResourceHandle::setClientCertificateInfo):
1113         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1114         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
1115         (WebCore::ResourceHandleCurlDelegate::setupRequest):
1116         (WebCore::ResourceHandleCurlDelegate::notifyFail):
1117         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtx):
1118         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtxCallback):
1119         * platform/network/curl/ResourceHandleCurlDelegate.h:
1120
1121 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1122
1123         REGRESSION(r221974): [Harfbuzz] Test fast/text/international/hebrew-selection.html is failing since r221974
1124         https://bugs.webkit.org/show_bug.cgi?id=177036
1125
1126         Reviewed by Michael Catanzaro.
1127
1128         In r221974 I rewrote the characterIndexForXPosition implementation without taking into account that there can be
1129         multiple glyphs for the same character, so we can't simply do index++ and index-- to get the next and previous
1130         character index.
1131
1132         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1133         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition): Always get the character index from
1134         m_glyphToCharacterIndexes array.
1135
1136 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1137
1138         [Harfbuzz] Test fast/text/complex-text-selection.html is failing since r222090
1139         https://bugs.webkit.org/show_bug.cgi?id=177035
1140
1141         Reviewed by Michael Catanzaro.
1142
1143         The problem was not actually introduced in r222090, but revelaed by that change. The bug was added in r222086,
1144         when adding the support for shaping a range of characters. We are not correctly filtering the characters in case
1145         of rtl in some cases.
1146
1147         Fixes: fast/text/complex-text-selection.html
1148
1149         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1150         (WebCore::HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun): When checking if the current character is inside
1151         the given range, continue or break the loop depending on whether text is rtl or not.
1152
1153 2017-09-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1154
1155         [GTK] Build failure with enchant-2.1.1
1156         https://bugs.webkit.org/show_bug.cgi?id=176877
1157
1158         Unreviewed build fix for enchant 2.1.1.
1159
1160         enchant_dict_free_suggestions() has been deprecated since at least 2005. Use its
1161         replacement, enchant_dict_free_string_list(), instead. That's also been around since at
1162         least 2005.
1163
1164         * platform/text/enchant/TextCheckerEnchant.cpp:
1165         (WebCore::TextCheckerEnchant::getGuessesForWord):
1166
1167 2017-09-16  Antti Koivisto  <antti@apple.com>
1168
1169         Computing animated style should not require renderers
1170         https://bugs.webkit.org/show_bug.cgi?id=171926
1171         <rdar://problem/34428035>
1172
1173         Reviewed by Sam Weinig.
1174
1175         CSS animation system is now element rather than renderer based. This allows cleaning up
1176         style resolution and render tree update code.
1177
1178         This also fixes bug animation doesn't run if display property is animated from one rendered type
1179         to another. Added a test case for this.
1180
1181         Test: transitions/transition-display-property-2.html
1182
1183         * page/animation/CSSAnimationController.cpp:
1184         (WebCore::CSSAnimationController::updateAnimations):
1185
1186             Pass in the old style instead of getting it from the renderer.
1187             Factor to return the animated style as a return value.
1188
1189         * page/animation/CSSAnimationController.h:
1190         * rendering/RenderElement.cpp:
1191         (WebCore::RenderElement::RenderElement):
1192         (WebCore::RenderElement::willBeDestroyed):
1193
1194             Animation are now canceled by RenderTreeUpdater::tearDownRenderers.
1195
1196         * rendering/RenderElement.h:
1197         (WebCore::RenderElement::hasInitialAnimatedStyle const): Deleted.
1198         (WebCore::RenderElement::setHasInitialAnimatedStyle): Deleted.
1199
1200             We no longer need to this concept.
1201
1202         * style/RenderTreeUpdater.cpp:
1203         (WebCore::RenderTreeUpdater::updateElementRenderer):
1204         (WebCore::RenderTreeUpdater::createRenderer):
1205
1206             We now get correct animated style from style resolution in all cases so we don't need to compute
1207             it separately for new renderers.
1208
1209         (WebCore::RenderTreeUpdater::tearDownRenderers):
1210
1211             Cancel animations when render tree is fully torn down. Keep them when updating style.
1212
1213         * style/RenderTreeUpdater.h:
1214         * style/StyleTreeResolver.cpp:
1215         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1216
1217             We can now compute animated style without renderer. Special cases dealing with rendererless case
1218             can be removed.
1219
1220 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1221
1222         [Harbuzz] Test fast/text/international/harfbuzz-runs-with-no-glyph.html is crashing
1223         https://bugs.webkit.org/show_bug.cgi?id=177005
1224
1225         Reviewed by Michael Catanzaro.
1226
1227         Fixes: fast/text/international/harfbuzz-runs-with-no-glyph.html
1228
1229         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1230         (WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): Return early if there aren't glyphs.
1231
1232 2017-09-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
1233
1234         Avoid calling String::format() in PlatformCAFilters::setFiltersOnLayer()
1235         https://bugs.webkit.org/show_bug.cgi?id=177028
1236
1237         Reviewed by Tim Horton.
1238
1239         String::format() is a bigger hammer for what we need to do in this function.
1240
1241         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
1242
1243 2017-09-15  Ryosuke Niwa  <rniwa@webkit.org>
1244
1245         iOS: Use blob URL instead of a WebKit fake URL when pasting an image
1246         https://bugs.webkit.org/show_bug.cgi?id=176986
1247         <rdar://problem/34455052>
1248
1249         Reviewed by Wenson Hsieh.
1250
1251         Fixed the bug that pasting an image on iOS resulted in an img element with src attribute
1252         set to a WebKit fake URL so that the Web content could never save it.
1253
1254         Like r208451 on Mac, use a Blob URL instead.
1255
1256         This patch also removes createFragmentForImageResourceAndAddResource since it's no longer used.
1257
1258         Tests: LayoutTests/editing/pasteboard/paste-image-as-blob-url.html
1259
1260         * editing/cocoa/WebContentReaderCocoa.mm:
1261         (WebCore::WebContentReader::readImage): Moved the code here from WebContentReaderMac.mm.
1262         * editing/ios/WebContentReaderIOS.mm:
1263         (WebCore::WebContentReader::readImage): Deleted. This is the code 
1264         * editing/mac/WebContentReaderMac.mm:
1265         (WebCore::WebContentReader::readImage): Moved to WebContentReaderCocoa.mm. Note that
1266         typeAsFilenameWithExtension was dead code after r208451
1267         * editing/markup.cpp:
1268         (WebCore::createFragmentForImageResourceAndAddResource): Deleted.
1269         * editing/markup.h:
1270
1271 2017-09-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1272
1273         Avoid style recomputation when forwarding a focus event to an text field's input type
1274         https://bugs.webkit.org/show_bug.cgi?id=176160
1275         <rdar://problem/34184820>
1276
1277         Reviewed by Ryosuke Niwa.
1278
1279         Currently, TextFieldInputType::forwardEvent synchronously triggers style recomputation, for the purpose of
1280         scrolling to the origin upon handling a blur event, and also for updating caps lock state after a blur or focus.
1281         In synchronously triggering style recomputation, we may end up running arbitrary JavaScript, which may change
1282         the HTMLInputElement's type and cause the current TextFieldInputType to be destroyed.
1283
1284         To mitigate this, we only update caps lock state when forwarding a focus or blur event to the InputType, and
1285         instead scroll blurred text fields to the origin later, in HTMLInputElement::didBlur (invoked from
1286         Document::setFocusedElement after blur and focusout events have fired). Instead of having the InputType update
1287         style, lift the call to Document::updateStyleIfNeeded up into HTMLInputElement so that we gracefully handle the
1288         case where the page destroys and sets a new InputType within the scope of this style update.
1289
1290         Test: fast/forms/change-input-type-in-focus-handler.html
1291
1292         * dom/Document.cpp:
1293         (WebCore::Document::setFocusedElement):
1294         * html/HTMLInputElement.cpp:
1295         (WebCore::HTMLInputElement::didBlur):
1296         * html/HTMLInputElement.h:
1297         * html/InputType.h:
1298         (WebCore::InputType::elementDidBlur):
1299         * html/TextFieldInputType.cpp:
1300         (WebCore::TextFieldInputType::forwardEvent):
1301         (WebCore::TextFieldInputType::elementDidBlur):
1302         * html/TextFieldInputType.h:
1303
1304 2017-09-15  JF Bastien  <jfbastien@apple.com>
1305
1306         WTF: use Forward.h when appropriate instead of Vector.h
1307         https://bugs.webkit.org/show_bug.cgi?id=176984
1308
1309         Reviewed by Saam Barati.
1310
1311         There's no need to include Vector.h when Forward.h will suffice. All we need is to move the template default parameters from Vector, and then the forward declaration can be used in so many new places: if a header only takes Vector by reference, rvalue reference, pointer, returns any of these, or has them as members then the header doesn't need to see the definition because the declaration will suffice.
1312
1313         * Modules/entriesapi/FileSystemEntriesCallback.h:
1314         * Modules/indexeddb/IDBEventDispatcher.h:
1315         * Modules/indexeddb/IDBFactory.h:
1316         * Modules/indexeddb/client/IDBConnectionProxy.h:
1317         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
1318         * Modules/webdatabase/DatabaseTask.h:
1319         * Modules/websockets/WebSocketChannelClient.h:
1320         * contentextensions/CombinedURLFilters.h:
1321         * crypto/SerializedCryptoKeyWrap.h:
1322         * css/InspectorCSSOMWrappers.h:
1323         * css/PageRuleCollector.h:
1324         * css/parser/CSSParserTokenRange.h:
1325         * dom/DocumentTouch.h:
1326         * dom/MutationCallback.h:
1327         * editing/EditingStyle.h:
1328         * editing/SpellChecker.h:
1329         * editing/markup.h:
1330         * fileapi/ThreadableBlobRegistry.h:
1331         * html/FileListCreator.h:
1332         * inspector/WebHeapAgent.h:
1333         * loader/ContentFilter.cpp:
1334         (WebCore::ContentFilter::ContentFilter):
1335         * loader/ContentFilter.h:
1336         * loader/CookieJar.h:
1337         * loader/FrameLoaderClient.h:
1338         * loader/LoaderStrategy.h:
1339         * loader/SubframeLoader.h:
1340         * page/ChromeClient.h:
1341         * page/FrameSnapshotting.h:
1342         * page/IntersectionObserverCallback.h:
1343         * page/PageSerializer.h:
1344         * page/UserContentURLPattern.h:
1345         * page/scrolling/AxisScrollSnapOffsets.h:
1346         * page/win/FrameWin.h:
1347         * platform/CookiesStrategy.h:
1348         * platform/KeyedCoding.h:
1349         * platform/PasteboardStrategy.h:
1350         * platform/SSLKeyGenerator.h:
1351         * platform/ScrollableArea.h:
1352         * platform/encryptedmedia/CDMFactory.h:
1353         * platform/gamepad/EmptyGamepadProvider.cpp:
1354         * platform/gamepad/GamepadProvider.h:
1355         * platform/gamepad/GamepadProviderClient.h:
1356         * platform/gamepad/PlatformGamepad.h:
1357         * platform/graphics/GeometryUtilities.cpp:
1358         * platform/graphics/GeometryUtilities.h:
1359         * platform/graphics/Icon.h:
1360         * platform/graphics/LayoutRect.h:
1361         * platform/graphics/Path.h:
1362         * platform/graphics/WOFFFileFormat.h:
1363         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1364         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h:
1365         * platform/graphics/ca/PlatformCAAnimation.h:
1366         * platform/graphics/ca/win/PlatformCALayerWinInternal.h:
1367         * platform/graphics/opentype/OpenTypeMathData.h:
1368         * platform/image-encoders/JPEGImageEncoder.h:
1369         * platform/image-encoders/PNGImageEncoder.h:
1370         * platform/network/BlobRegistry.h:
1371         * platform/network/HTTPParsers.h:
1372         * platform/network/PlatformCookieJar.h:
1373         * platform/network/cf/DownloadBundle.h:
1374         * platform/network/curl/CurlCacheEntry.h:
1375         * platform/network/curl/DownloadBundle.h:
1376         * platform/text/LineEnding.h:
1377         * platform/text/QuotedPrintable.cpp:
1378         * platform/text/QuotedPrintable.h:
1379         * rendering/FlexibleBoxAlgorithm.h:
1380         * rendering/style/QuotesData.h:
1381         * rendering/svg/SVGSubpathData.h:
1382         * storage/StorageEventDispatcher.h:
1383         * style/StyleInvalidator.h:
1384         * style/StyleRelations.h:
1385         * svg/SVGAltGlyphDefElement.h:
1386         * svg/SVGAltGlyphItemElement.h:
1387
1388 2017-09-15  Youenn Fablet  <youenn@apple.com>
1389
1390         ASSERTION FAILED: writtenAudioDuration >= readAudioDuration in com.apple.WebCore:WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataHighLimit() + 222
1391         https://bugs.webkit.org/show_bug.cgi?id=175164
1392         <rdar://problem/33712305>
1393
1394         Reviewed by Eric Carlson.
1395
1396         No observable change of behavior.
1397
1398         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1399         (WebCore::RealtimeOutgoingAudioSource::hasBufferedEngouhData):
1400         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): Calling pullData only if there is at least 0.01 seconds of available data.
1401         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1402
1403 2017-09-15  Youenn Fablet  <youenn@apple.com>
1404
1405         Move code using Vector::map to WTF:map
1406         https://bugs.webkit.org/show_bug.cgi?id=176860
1407
1408         Reviewed by Jer Noble.
1409
1410         No change of behavior.
1411
1412         * loader/FormSubmission.cpp:
1413         (WebCore::FormSubmission::create): Moving to WTF::map.
1414         * page/Settings.cpp:
1415         (WebCore::Settings::setMediaContentTypesRequiringHardwareSupport): Using iterator split to not create a temporary vector.
1416         * platform/ContentType.cpp:
1417         (WebCore::ContentType::ContentType):
1418         (WebCore::splitParameters):
1419         (WebCore::ContentType::codecs const): Ditto.
1420         (WebCore::ContentType::profiles const): Ditto.
1421         (WebCore::stripHTMLWhiteSpace): Deleted.
1422         * platform/ContentType.h:
1423         (WebCore::ContentType::create): Deleted.
1424         * platform/graphics/MediaPlayer.cpp:
1425         (WebCore::MediaPlayer::load): Minor count churning change.
1426
1427 2017-09-15  Youenn Fablet  <youenn@apple.com>
1428
1429         MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData should enqueue data if still useful
1430         https://bugs.webkit.org/show_bug.cgi?id=177016
1431
1432         Reviewed by Jer Noble.
1433
1434         No change of behavior.
1435
1436         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1437         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData): exciting early in block to prevent enqueueing.
1438
1439 2017-09-15  Ryan Haddad  <ryanhaddad@apple.com>
1440
1441         Unreviewed, rolling out r222040.
1442
1443         The LayoutTest added with this change is a flaky image failure
1444         on mac-wk1 debug bots.
1445
1446         Reverted changeset:
1447
1448         "Computing animated style should not require renderers"
1449         https://bugs.webkit.org/show_bug.cgi?id=171926
1450         http://trac.webkit.org/changeset/222040
1451
1452 2017-09-15  Tim Horton  <timothy_horton@apple.com>
1453
1454         Fix the macOS CMake build
1455         https://bugs.webkit.org/show_bug.cgi?id=177015
1456
1457         Reviewed by Andy Estes.
1458
1459         * CMakeLists.txt:
1460         Add Payment Request files.
1461
1462         * PlatformMac.cmake:
1463         Add the CoreServices umbrella framework to the framework search path.
1464         Add service workers directories to the forwarding headers path.
1465         Add Modules/cache directory to the forwarding headers path.
1466
1467         * rendering/svg/RenderSVGRoot.cpp:
1468         (WebCore::resolveLengthAttributeForSVG): Deleted unused function.
1469
1470 2017-09-15  John Wilander  <wilander@apple.com>
1471
1472         Storage Access API: Deny access to nested iframes
1473         https://bugs.webkit.org/show_bug.cgi?id=176939
1474         <rdar://problem/34439609>
1475
1476         Reviewed by Brent Fulgham.
1477
1478         Test: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html
1479
1480         * dom/Document.cpp:
1481         (WebCore::Document::requestStorageAccess):
1482
1483 2017-09-15  Antti Koivisto  <antti@apple.com>
1484
1485         AnimationBase should ref the element
1486         https://bugs.webkit.org/show_bug.cgi?id=176993
1487
1488         Reviewed by Simon Fraser.
1489
1490         We now longer have renderer pointer. Element can be reffed for safety.
1491
1492         This doesn't create reference cycle as the element pointer is cleared when render tree is
1493         torn down. This happens at the latest when the element is removed from the tree.
1494
1495         * page/animation/AnimationBase.cpp:
1496         (WebCore::AnimationBase::~AnimationBase):
1497         (WebCore::AnimationBase::clear):
1498         * page/animation/AnimationBase.h:
1499         (WebCore::AnimationBase::~AnimationBase): Deleted.
1500         (WebCore::AnimationBase::clear): Deleted.
1501         * page/animation/ImplicitAnimation.cpp:
1502         (WebCore::ImplicitAnimation::pauseAnimation):
1503         (WebCore::ImplicitAnimation::sendTransitionEvent):
1504         (WebCore::ImplicitAnimation::reset):
1505         * page/animation/KeyframeAnimation.cpp:
1506         (WebCore::KeyframeAnimation::pauseAnimation):
1507         (WebCore::KeyframeAnimation::endAnimation):
1508         (WebCore::KeyframeAnimation::sendAnimationEvent):
1509         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
1510
1511 2017-09-15  Brent Fulgham  <bfulgham@apple.com>
1512
1513         Make DocumentLoader a FrameDestructionObserver
1514         https://bugs.webkit.org/show_bug.cgi?id=176364
1515         <rdar://problem/34254780>
1516
1517         Reviewed by Alex Christensen.
1518
1519         The DocumentLoader needs to know when its Frame is destroyed so that it can
1520         perform properly cleanup.
1521
1522         Test: fast/events/beforeunload-dom-manipulation-crash.html
1523
1524         * loader/DocumentLoader.cpp:
1525         (WebCore::DocumentLoader::DocumentLoader): Call FrameDestructionObserver constructor.
1526         (WebCore::DocumentLoader::responseReceived): Drive-by fix. Make sure the current
1527         object is valid during the callback.
1528         (WebCore::DocumentLoader::attachToFrame): Use FrameDestructionObserver::observerFrame rather
1529         than setting the m_frame variable directly.
1530         (WebCore::DocumentLoader::detachFromFrame): Ditto.
1531         * loader/DocumentLoader.h:
1532         (WebCore::DocumentLoader::frame const): Deleted, as this is provided by the FrameDestructionObserver.
1533
1534 2017-09-15  Ms2ger  <Ms2ger@igalia.com>
1535
1536         Update some WebGL2 return types to match the specification.
1537         https://bugs.webkit.org/show_bug.cgi?id=176996
1538
1539         Reviewed by Alex Christensen.
1540
1541         This should not change the behavior in any way, but it makes it simpler
1542         to compare our IDL with the specification's.
1543
1544         No new tests because there is no behavior change.
1545
1546         * html/canvas/WebGL2RenderingContext.cpp:
1547         (WebCore::WebGL2RenderingContext::getUniformIndices):
1548         * html/canvas/WebGL2RenderingContext.h:
1549         * html/canvas/WebGL2RenderingContext.idl:
1550
1551 2017-09-15  Antti Koivisto  <antti@apple.com>
1552
1553         Remove FilterOperation::blendingNeedsRendererSize()
1554         https://bugs.webkit.org/show_bug.cgi?id=176994
1555
1556         Reviewed by Simon Fraser.
1557
1558         It is not used.
1559
1560         * page/animation/CSSPropertyAnimation.cpp:
1561         (WebCore::blendFunc):
1562         * platform/graphics/filters/FilterOperation.h:
1563         (WebCore::FilterOperation::blend):
1564         (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin const):
1565         (WebCore::FilterOperation::blendingNeedsRendererSize const): Deleted.
1566
1567 2017-09-15  Youenn Fablet  <youenn@apple.com>
1568
1569         Add an URL method to remove both query string and fragment identifier
1570         https://bugs.webkit.org/show_bug.cgi?id=176911
1571
1572         Reviewed by Alex Christensen.
1573
1574         Covered by existing tests and new API tests.
1575
1576         * Modules/cache/DOMCache.cpp:
1577         (WebCore::DOMCache::retrieveRecords): Using new helper method.
1578         * platform/URL.cpp:
1579         (WebCore::URL::removeQueryAndFragmentIdentifier):
1580         * platform/URL.h:
1581
1582 2017-09-15  Andy Estes  <aestes@apple.com>
1583
1584         [Cocoa] Upstream MediaRemote and VideoToolbox WebKitSystemInterface functions
1585         https://bugs.webkit.org/show_bug.cgi?id=176953
1586
1587         Reviewed by Eric Carlson.
1588
1589         * platform/cocoa/VideoToolboxSoftLink.cpp:
1590         * platform/cocoa/VideoToolboxSoftLink.h:
1591         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1592         (WebCore::queryDecoderAvailability):
1593         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
1594         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1595         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetType const):
1596         (WebCore::exernalDeviceDisplayNameForPlayer):
1597         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
1598         * platform/ios/WebCoreSystemInterfaceIOS.mm:
1599         * platform/mac/MediaRemoteSoftLink.cpp:
1600         * platform/mac/MediaRemoteSoftLink.h:
1601         * platform/mac/WebCoreSystemInterface.h:
1602         * platform/mac/WebCoreSystemInterface.mm:
1603
1604 2017-09-15  Eric Carlson  <eric.carlson@apple.com>
1605
1606         Switch text tracks to release logging
1607         https://bugs.webkit.org/show_bug.cgi?id=176809
1608         <rdar://problem/34397605>
1609
1610         Reviewed by Jer Noble.
1611
1612         Make all track objects use the same logger and log identifier as the media element they
1613         "belong" to. Convert all track logging from debug-only to release logging.
1614
1615         * WebCore.xcodeproj/project.pbxproj:
1616         * html/HTMLMediaElement.cpp:
1617         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1618         * html/HTMLMediaElement.h:
1619         * html/track/AudioTrack.cpp:
1620         (WebCore::AudioTrack::AudioTrack):
1621         (WebCore::AudioTrack::setPrivate):
1622         (WebCore::AudioTrack::setMediaElement):
1623         * html/track/AudioTrack.h:
1624         * html/track/DataCue.cpp:
1625         (WebCore::DataCue::toString const):
1626         * html/track/DataCue.h:
1627         (PAL::LogArgument<WebCore::DataCue>::toString):
1628         * html/track/InbandDataTextTrack.cpp:
1629         (WebCore::InbandDataTextTrack::addDataCue):
1630         (WebCore::InbandDataTextTrack::updateDataCue):
1631         (WebCore::InbandDataTextTrack::removeDataCue):
1632         * html/track/InbandDataTextTrack.h:
1633         * html/track/InbandGenericTextTrack.cpp:
1634         (WebCore::InbandGenericTextTrack::addGenericCue):
1635         (WebCore::InbandGenericTextTrack::removeGenericCue):
1636         (WebCore::InbandGenericTextTrack::newCuesParsed):
1637         (WebCore::InbandGenericTextTrack::fileFailedToParse):
1638         * html/track/InbandGenericTextTrack.h:
1639         * html/track/InbandTextTrack.cpp:
1640         (WebCore::InbandTextTrack::InbandTextTrack):
1641         (WebCore::InbandTextTrack::setMediaElement):
1642         * html/track/InbandTextTrack.h:
1643         * html/track/InbandWebVTTTextTrack.cpp:
1644         (WebCore::InbandWebVTTTextTrack::newCuesParsed):
1645         (WebCore::InbandWebVTTTextTrack::fileFailedToParse):
1646         * html/track/InbandWebVTTTextTrack.h:
1647         * html/track/LoadableTextTrack.cpp:
1648         (WebCore::LoadableTextTrack::newCuesAvailable):
1649         (WebCore::LoadableTextTrack::cueLoadingCompleted):
1650         * html/track/LoadableTextTrack.h:
1651         * html/track/TextTrack.cpp:
1652         (WebCore::TextTrack::addCue):
1653         (WebCore::TextTrack::removeCue):
1654         (WebCore::TextTrack::setLanguage):
1655         * html/track/TextTrack.h:
1656         * html/track/TextTrackCue.cpp:
1657         (WebCore::TextTrackCue::toString const):
1658         * html/track/TextTrackCue.h:
1659         (PAL::LogArgument<WebCore::TextTrackCue>::toString):
1660         * html/track/TextTrackCueGeneric.cpp:
1661         (WebCore::TextTrackCueGeneric::setFontSize):
1662         (WebCore::TextTrackCueGeneric::toString const):
1663         * html/track/TextTrackCueGeneric.h:
1664         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString):
1665         * html/track/TrackBase.cpp:
1666         (WebCore::nextLogIdentifier):
1667         (WebCore::nullLogger):
1668         (WebCore::TrackBase::TrackBase):
1669         (WebCore::TrackBase::setMediaElement):
1670         (WebCore::TrackBase::logChannel const):
1671         (WebCore::TrackBase::~TrackBase): Deleted.
1672         * html/track/TrackBase.h:
1673         (WebCore::TrackBase::setMediaElement): Deleted.
1674         * html/track/VTTCue.cpp:
1675         (WebCore::VTTCue::setFontSize):
1676         (WebCore::VTTCue::toString const):
1677         * html/track/VTTCue.h:
1678         (PAL::LogArgument<WebCore::VTTCue>::toString):
1679         * html/track/VideoTrack.cpp:
1680         (WebCore::VideoTrack::VideoTrack):
1681         (WebCore::VideoTrack::setPrivate):
1682         (WebCore::VideoTrack::setMediaElement):
1683         * html/track/VideoTrack.h:
1684         * platform/graphics/AudioTrackPrivate.h:
1685         * platform/graphics/InbandTextTrackPrivate.h:
1686         (WebCore::InbandTextTrackPrivate::setClient):
1687         * platform/graphics/InbandTextTrackPrivateClient.h:
1688         (WebCore::GenericCueData::toString const):
1689         (PAL::LogArgument<WebCore::GenericCueData>::toString):
1690         * platform/graphics/TrackPrivateBase.cpp: Added.
1691         (WebCore::TrackPrivateBase::setLogger):
1692         (WebCore::TrackPrivateBase::logChannel const):
1693         * platform/graphics/TrackPrivateBase.h:
1694         * platform/graphics/VideoTrackPrivate.h:
1695         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
1696         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
1697         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes):
1698         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues):
1699         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h:
1700         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
1701         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings):
1702         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues):
1703         (WebCore::InbandTextTrackPrivateAVF::resetCueValues):
1704         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
1705         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
1706         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
1707         * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm:
1708         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1709         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1710         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1711         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1712         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1713
1714 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1715
1716         [Harfbuzz] Material icons not rendered correctly when using the web font
1717         https://bugs.webkit.org/show_bug.cgi?id=176995
1718
1719         Reviewed by Michael Catanzaro.
1720
1721         Only a few of them are correctly rendered and some others are wrong. We only render correctly the ones that
1722         don't have an underscore in their name (or that start with a number like 3d_rotation). In the cases where the
1723         name before the underscore is also an icon, we render that icon instead, that's why some of them are wrong. This
1724         is happening because the underscore is causing the HarfbuffShaper to split the text in 3 runs, one for the word
1725         before the underscore, another one for the underscore and another for the word after the underscore. So, we
1726         end up trying to shape the 3 runs independently and we fail when the icon doesn't exist, or when it exists but
1727         it's not the one we are looking for. The cause of this is that the underscore has a different script (Common)
1728         than the rest of characters (Latin) which is a condition in HarfbuffShaper to create a different run. The
1729         unicode spec says that characters with Common script should be handled differently, but we are just ignoring
1730         it. The spec proposes to use an heuristic based on simply inheriting the script of the previous character, which
1731         should work in most of the cases. We could take a more conservative approach and do that only if both characters
1732         are ASCII. We should also consider handling other cases mentioned by the spec like brackets and quotation marks,
1733         but that belongs to a different bug/commit.
1734
1735         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1736         (WebCore::scriptsAreCompatibleForCharacters): Helper function to check if the current and previous scripts are
1737         compatible,
1738         (WebCore::HarfBuzzShaper::collectHarfBuzzRuns): Use scriptsAreCompatibleForCharacters() to decided whether to
1739         finish the current run or not. In case of Common script, inherit also the script from the previous character.
1740
1741 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1742
1743         [Harfbuzz] Fix incorrect font rendering when selecting texts in pages which specifies text-rendering: optimizeLegibility
1744         https://bugs.webkit.org/show_bug.cgi?id=148220
1745
1746         Reviewed by Michael Catanzaro.
1747
1748         Add support for shaping a range of characters and return the advance to the first glyph in the range.
1749
1750         Covered by existing tests.
1751
1752         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1753         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Pass "from" and "to" parameters to
1754         HarfBuzzShaper::shape and return the x position of the selection rect.
1755         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1756         (WebCore::HarfBuzzShaper::shape): Forward "from" and "to" parameters to fillGlyphBuffer().
1757         (WebCore::HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun): Only add glyphs for the given character range.
1758         (WebCore::HarfBuzzShaper::fillGlyphBuffer): Only consider runs in the given character range.
1759         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
1760
1761 2017-09-15  Zan Dobersek  <zdobersek@igalia.com>
1762
1763         [EME] ClearKey: list 'persistent-license' sessions as supported
1764         https://bugs.webkit.org/show_bug.cgi?id=176985
1765
1766         Reviewed by Xabier Rodriguez-Calvar.
1767
1768         The ClearKey implementation should support the 'persistent-license'
1769         session type for testing purposes. Methods in the CDMPrivateClearKey
1770         class have been updated to handle that session type as supported:
1771         - supportsSessionTypeWithConfiguration() returns true for the
1772           'persistent-license' session type values,
1773         - supportsConfiguration() allows persistent state as required in
1774           case of the configured session type being 'persistent-license',
1775         - supportsConfigurationWithRestrictions() as well allows persistent
1776         state as required for 'persistent-license' session types.
1777
1778         No new tests -- affected tests have their baselines updated.
1779
1780         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1781         (WebCore::CDMPrivateClearKey::supportsConfiguration const):
1782         (WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions const):
1783         (WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration const):
1784
1785 2017-09-15  Ms2ger  <Ms2ger@igalia.com>
1786
1787         Disallow passing a null program to getFragDataLocation.
1788         https://bugs.webkit.org/show_bug.cgi?id=176895
1789
1790         Reviewed by Sam Weinig.
1791
1792         This matches the specification as well as Gecko and Chromium.
1793
1794         Test: fast/canvas/webgl/webgl2/bindings.html
1795
1796         * html/canvas/WebGL2RenderingContext.cpp:
1797         (WebCore::WebGL2RenderingContext::getFragDataLocation):
1798         * html/canvas/WebGL2RenderingContext.h:
1799         * html/canvas/WebGL2RenderingContext.idl:
1800
1801 2017-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1802
1803         [FreeType] Complex text is enabled too often after r221909
1804         https://bugs.webkit.org/show_bug.cgi?id=176907
1805
1806         Reviewed by Sergio Villar Senin.
1807
1808         In r221909 we enabled complex text by default following the same cocoa ifdefs, but I forgot another ifdef in the
1809         cpp file.
1810
1811         * platform/graphics/FontCascade.cpp:
1812         (WebCore::FontCascade::codePath const):
1813
1814 2017-09-14  Commit Queue  <commit-queue@webkit.org>
1815
1816         Unreviewed, rolling out r221932 and r221933.
1817         https://bugs.webkit.org/show_bug.cgi?id=176969
1818
1819         This change did not fix the webgl test flakiness. (Requested
1820         by ryanhaddad on #webkit).
1821
1822         Reverted changesets:
1823
1824         "[WebGL] accelerated texImage2D for video doesn't respect
1825         flipY"
1826         https://bugs.webkit.org/show_bug.cgi?id=176491
1827         http://trac.webkit.org/changeset/221932
1828
1829         "[WebGL] VideoTextureCopierCV doesn't correctly restore vertex
1830         attribute state"
1831         https://bugs.webkit.org/show_bug.cgi?id=176771
1832         http://trac.webkit.org/changeset/221933
1833
1834 2017-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1835
1836         [Curl] Replace the implementation with NetworkLoadMetrics
1837         https://bugs.webkit.org/show_bug.cgi?id=176906
1838
1839         Reviewed by Alex Christensen.
1840
1841         * platform/network/curl/CurlContext.cpp:
1842         (WebCore::CurlHandle::getEffectiveURL):
1843         (WebCore::CurlHandle::getPrimaryPort):
1844         (WebCore::CurlHandle::getResponseCode):
1845         (WebCore::CurlHandle::getContentLenghtDownload):
1846         (WebCore::CurlHandle::getHttpAuthAvail):
1847         (WebCore::CurlHandle::getTimes):
1848         (WebCore::CurlHandle::getEffectiveURL const): Deleted.
1849         * platform/network/curl/CurlContext.h:
1850         * platform/network/curl/CurlDownload.cpp:
1851         (WebCore::CurlDownload::didReceiveHeader):
1852         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1853         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
1854         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
1855         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
1856         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
1857         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
1858         (WebCore::ResourceHandleCurlDelegate::didFinish):
1859         (WebCore::ResourceHandleCurlDelegate::getNetworkLoadMetrics):
1860         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
1861         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
1862         (WebCore::ResourceHandleCurlDelegate::setWebTimings): Deleted.
1863         * platform/network/curl/ResourceHandleCurlDelegate.h:
1864         * platform/network/curl/ResourceResponse.h:
1865         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
1866
1867 2017-09-14  Daniel Bates  <dabates@apple.com>
1868
1869         [Mac] Spelling, grammar and correction dots are painted upside down
1870         https://bugs.webkit.org/show_bug.cgi?id=176949
1871         <rdar://problem/34441098>
1872
1873         Reviewed by Simon Fraser.
1874
1875         Painting occurs in a vertically flipped context. Vertically flip the context ("unflip" it)
1876         before painting the document markers on macOS so that they are painted right-side. This makes
1877         the appearance of spelling, grammar and correction dots in WebKit match the AppKit appearance
1878         of these dots.
1879
1880         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1881         (WebCore::GraphicsContext::drawLineForDocumentMarker): Flip the context as described above.
1882         Also make use of RAII object CGContextStateSaver instead of manually saving and restoring
1883         the state of the context.
1884
1885 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
1886
1887         Unreviewed rollout r222036.
1888         
1889         The LayoutTests added with this change is flaky.
1890
1891         Reverted changeset
1892         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
1893         https://bugs.webkit.org/show_bug.cgi?id=176824
1894         http://trac.webkit.org/changeset/222036
1895
1896 2017-09-14  Ryosuke Niwa  <rniwa@webkit.org>
1897
1898         WebContentReader::readWebArchive doesn't need to handle image MIME type
1899         https://bugs.webkit.org/show_bug.cgi?id=176884
1900
1901         Reviewed by Sam Weinig.
1902
1903         Remove the code to handle image MIME types in the web archive on macOS since we have a separate code path
1904         to handle images in the pasteboard directly. As far as I can tell, this code is never used in practice.
1905
1906         This allows merging iOS and macOS code to read web archive from the pasteboard. Also merged member functions
1907         for handling RTFD and RTF in iOS and macOS in WebContentReaderCocoa.mm.
1908
1909         * CMakeLists.txt:
1910         * WebCore.xcodeproj/project.pbxproj:
1911         * editing/WebContentReader.cpp: Added.
1912         (WebCore::WebContentReader::addFragment): Moved from WebContentReaderIOS.mm and simplified since appendChild
1913         knows how to add a DocumentFragment.
1914         * editing/WebContentReader.h:
1915         * editing/cocoa/WebContentReaderCocoa.mm:
1916         (WebCore::createFragmentAndAddResources):
1917         (WebCore::WebContentReader::readWebArchive): Merged iOS / macOS code here.
1918         (WebCore::WebContentReader::readRTFD): Ditto.
1919         (WebCore::WebContentReader::readRTF): Ditto.
1920         (WebCore::WebContentReader::readPlainText): Ditto.
1921         * editing/ios/EditorIOS.mm:
1922         (WebCore::Editor::pasteWithPasteboard):
1923         * editing/ios/WebContentReaderIOS.mm:
1924         (WebCore::WebContentReader::readImage):
1925         (WebCore::WebContentReader::readURL):
1926         (WebCore::WebContentReader::readWebArchive): Moved to WebContentReaderCocoa.mm.
1927         (WebCore::WebContentReader::readRTFD): Ditto.
1928         (WebCore::WebContentReader::readRTF): Ditto.
1929         (WebCore::WebContentReader::readPlainText): Ditto.
1930         * editing/mac/WebContentReaderMac.mm:
1931         (WebCore::WebContentReader::readWebArchive): Ditto.
1932         (WebCore::WebContentReader::readRTFD): Ditto.
1933         (WebCore::WebContentReader::readRTF): Ditto.
1934
1935 2017-09-14  Devin Rousso  <webkit@devinrousso.com>
1936
1937         Web Inspector: make recording swizzle async
1938         https://bugs.webkit.org/show_bug.cgi?id=176936
1939
1940         Reviewed by Joseph Pecoraro.
1941
1942         * inspector/InspectorCanvas.cpp:
1943         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
1944         (WebCore::InspectorCanvas::buildAction):
1945         For objects that are not able to be stringified (e.g. elements), send a deduplicated string
1946         with the name of the object as a placeholder value (e.g. "Element").
1947
1948 2017-09-14  Andy Estes  <aestes@apple.com>
1949
1950         [Mac] Upstream SpeechSynthesis-related WebKitSystemInterface functions
1951         https://bugs.webkit.org/show_bug.cgi?id=176931
1952
1953         Reviewed by Joseph Pecoraro.
1954
1955         * platform/mac/PlatformSpeechSynthesizerMac.mm:
1956         (WebCore::speechSynthesisGetVoiceIdentifiers):
1957         (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
1958         (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
1959         * platform/mac/WebCoreSystemInterface.h:
1960         * platform/mac/WebCoreSystemInterface.mm:
1961
1962 2017-09-14  Youenn Fablet  <youenn@apple.com>
1963
1964         RTCDataChannel connectivity issues in Safari 11
1965         https://bugs.webkit.org/show_bug.cgi?id=173052
1966         <rdar://problem/32712143>
1967
1968         Reviewed by Alex Christensen.
1969
1970         Covered by updated test.
1971
1972         Before the patch, when sending an ArrayBufferView, RTCDataChannel was sending the whole ArrayBuffer backing the ArrayBufferView.
1973         With this patch, RTCDataChannel will now send only the bytes the ArrayBufferView is exposing.
1974
1975         * Modules/mediastream/RTCDataChannel.cpp:
1976         (WebCore::RTCDataChannel::send): Correctly handling sending of ArrayBufferView.
1977         (WebCore::RTCDataChannel::sendRawData): Helper routine for raw data sending.
1978         * Modules/mediastream/RTCDataChannel.h:
1979
1980 2017-09-14  Antti Koivisto  <antti@apple.com>
1981
1982         Computing animated style should not require renderers
1983         https://bugs.webkit.org/show_bug.cgi?id=171926
1984         <rdar://problem/34428035>
1985
1986         Reviewed by Sam Weinig.
1987
1988         CSS animation system is now element rather than renderer based. This allows cleaning up
1989         style resolution and render tree update code.
1990
1991         This also fixes bug animation doesn't run if display property is animated from one rendered type
1992         to another. Added a test case for this.
1993
1994         Test: transitions/transition-display-property-2.html
1995
1996         * page/animation/CSSAnimationController.cpp:
1997         (WebCore::CSSAnimationController::updateAnimations):
1998
1999             Pass in the old style instead of getting it from the renderer.
2000             Factor to return the animated style as a return value.
2001
2002         * page/animation/CSSAnimationController.h:
2003         * rendering/RenderElement.cpp:
2004         (WebCore::RenderElement::RenderElement):
2005         (WebCore::RenderElement::willBeDestroyed):
2006
2007             Animation are now canceled by RenderTreeUpdater::tearDownRenderers.
2008
2009         * rendering/RenderElement.h:
2010         (WebCore::RenderElement::hasInitialAnimatedStyle const): Deleted.
2011         (WebCore::RenderElement::setHasInitialAnimatedStyle): Deleted.
2012
2013             We no longer need to this concept.
2014
2015         * style/RenderTreeUpdater.cpp:
2016         (WebCore::RenderTreeUpdater::updateElementRenderer):
2017         (WebCore::RenderTreeUpdater::createRenderer):
2018
2019             We now get correct animated style from style resolution in all cases so we don't need to compute
2020             it separately for new renderers.
2021
2022         (WebCore::RenderTreeUpdater::tearDownRenderers):
2023
2024             Cancel animations when render tree is fully torn down. Keep them when updating style.
2025
2026         * style/RenderTreeUpdater.h:
2027         * style/StyleTreeResolver.cpp:
2028         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2029
2030             We can now compute animated style without renderer. Special cases dealing with rendererless case
2031             can be removed.
2032
2033 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
2034
2035         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
2036         https://bugs.webkit.org/show_bug.cgi?id=176824
2037         <rdar://problem/34290931>
2038
2039         Reviewed by Devin Rousso.
2040
2041         Test: inspector/timeline/timeline-event-EventDispatch.html
2042
2043         * dom/EventTarget.cpp:
2044         (WebCore::EventTarget::fireEventListeners):
2045         * page/DOMWindow.cpp:
2046         (WebCore::DOMWindow::dispatchEvent):
2047         Include defaultPrevented when notifying inspector.
2048
2049         * inspector/InspectorInstrumentation.cpp:
2050         (WebCore::InspectorInstrumentation::didDispatchEventImpl):
2051         (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
2052         * inspector/InspectorInstrumentation.h:
2053         (WebCore::InspectorInstrumentation::didDispatchEvent):
2054         (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
2055         Pass defaultPrevented on to agent.
2056
2057         * inspector/InspectorTimelineAgent.cpp:
2058         (WebCore::InspectorTimelineAgent::didDispatchEvent):
2059         (WebCore::InspectorTimelineAgent::didLayout):
2060         (WebCore::InspectorTimelineAgent::didPaint):
2061         * inspector/InspectorTimelineAgent.h:
2062         * inspector/TimelineRecordFactory.cpp:
2063         (WebCore::TimelineRecordFactory::appendLayoutRoot):
2064         (WebCore::TimelineRecordFactory::appendDidDispatchEventData):
2065         * inspector/TimelineRecordFactory.h:
2066         Append a boolean defaultPrevented property on the EventDispatch timeline record's data.
2067
2068 2017-09-14  Ryan Haddad  <ryanhaddad@apple.com>
2069
2070         Unreviewed, rolling out r222015.
2071
2072         The LayoutTests added with this change are flaky.
2073
2074         Reverted changeset:
2075
2076         "Web Inspector: Timeline should show when events
2077         preventDefault() was called on an event or not"
2078         https://bugs.webkit.org/show_bug.cgi?id=176824
2079         http://trac.webkit.org/changeset/222015
2080
2081 2017-09-14  Ms2ger  <Ms2ger@igalia.com>
2082
2083         Allow passing sequences to various WebGL2 methods.
2084         https://bugs.webkit.org/show_bug.cgi?id=176892
2085
2086         Reviewed by Sam Weinig.
2087
2088         This matches the specification as well as Gecko and Chromium.
2089
2090         Test: fast/canvas/webgl/webgl2/sequences.html
2091
2092         * html/canvas/WebGL2RenderingContext.cpp:
2093         (WebCore::WebGL2RenderingContext::uniform1uiv):
2094         (WebCore::WebGL2RenderingContext::uniform2uiv):
2095         (WebCore::WebGL2RenderingContext::uniform3uiv):
2096         (WebCore::WebGL2RenderingContext::uniform4uiv):
2097         (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv):
2098         (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv):
2099         (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv):
2100         (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv):
2101         (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv):
2102         (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv):
2103         (WebCore::WebGL2RenderingContext::vertexAttribI4iv):
2104         (WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
2105         (WebCore::WebGL2RenderingContext::clearBufferiv):
2106         (WebCore::WebGL2RenderingContext::clearBufferuiv):
2107         (WebCore::WebGL2RenderingContext::clearBufferfv):
2108         * html/canvas/WebGL2RenderingContext.h:
2109         * html/canvas/WebGL2RenderingContext.idl:
2110
2111 2017-09-14  Sam Weinig  <sam@webkit.org>
2112
2113         [Cleanup] Cleanup uses of the FileList class
2114         https://bugs.webkit.org/show_bug.cgi?id=176800
2115
2116         Reviewed by Alex Christensen.
2117
2118         * fileapi/FileList.cpp:
2119         * fileapi/FileList.h:
2120
2121             Store list of files as Refs, rather than RefPtrs.
2122             Add direct accessor to the underlying Vector for faster iteration.
2123             Add file(unsigned) function to allow direct indexing, rather than using
2124             the DOM exposed item function which always does a length check.
2125
2126         * Modules/entriesapi/HTMLInputElementEntriesAPI.cpp:
2127         
2128             Remove unused RuntimeEnabledFeatures.h #include.
2129             Use modern for loop and the new direct file vector access. 
2130         
2131         * bindings/js/SerializedScriptValue.cpp:
2132         (WebCore::CloneSerializer::dumpIfTerminal):
2133         (WebCore::CloneSerializer::write):
2134         (WebCore::CloneDeserializer::readFile):
2135         (WebCore::CloneDeserializer::readTerminal):
2136         
2137             Remove unnecessary #includes, adopt auto, and use modern for-loop
2138             for FileList.
2139         
2140         * dom/DataTransfer.cpp:
2141         (WebCore::DataTransfer::files const):
2142         (WebCore::DataTransfer::hasFileOfType):
2143         
2144             Use auto.
2145         
2146         (WebCore::DataTransfer::createForInputEvent):
2147         
2148             Use initializer list for the typeToStringMap.
2149         
2150         * dom/DataTransferItemList.cpp:
2151         (WebCore::DataTransferItemList::ensureItems const):
2152         
2153             Use auto and modern for-loop for FileList.
2154         
2155         * html/FileInputType.cpp:
2156         (WebCore::FileInputType::filesFromFormControlState):
2157         (WebCore::FileInputType::saveFormControlState const):
2158         (WebCore::FileInputType::appendFormData const):
2159         (WebCore::FileInputType::handleDOMActivateEvent):
2160         (WebCore::FileInputType::getTypeSpecificValue):
2161         (WebCore::FileInputType::disabledAttributeChanged):
2162         (WebCore::FileInputType::multipleAttributeChanged):
2163         (WebCore::FileInputType::setFiles):
2164         (WebCore::FileInputType::receiveDroppedFiles):
2165         (WebCore::FileInputType::defaultToolTip const):
2166
2167             Adopt auto, brace-initialization, and modern for-loops.
2168
2169         * html/FileListCreator.cpp:
2170         (WebCore::appendDirectoryFiles):
2171         (WebCore::FileListCreator::createFileList):
2172         
2173             Update to work in terms of Vector<Ref<File>>.
2174
2175         * html/FormController.h:
2176         (WebCore::FormControlState::FormControlState):
2177         
2178             Re-format existing constructors and add one that takes an r-value
2179             Vector<String> to allow construction from a pre-created list (used 
2180             in FileInputType::saveFormControlState)
2181         
2182         * platform/DragData.h:
2183         * platform/gtk/DragDataGtk.cpp:
2184         (WebCore::DragData::asFilenames const):
2185         * platform/mac/DragDataMac.mm:
2186         (WebCore::DragData::asFilenames const):
2187         * platform/win/DragDataWin.cpp:
2188         (WebCore::DragData::asFilenames const):
2189         
2190             Convert asFilenames to return, rather than take, a Vector<String>.
2191
2192 2017-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2193
2194         [Harfbuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition() when target point is at the middle of a character
2195         https://bugs.webkit.org/show_bug.cgi?id=176897
2196
2197         Reviewed by Michael Catanzaro.
2198
2199         We should include the character when the point is greater than the center of the character.
2200
2201         Fixes: fast/multicol/hit-test-end-of-column-with-line-height.html
2202                fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html
2203
2204         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2205         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
2206
2207 2017-09-14  Yusuke Suzuki  <utatane.tea@gmail.com>
2208
2209         [JSC] Add PrivateSymbolMode::{Include,Exclude} for PropertyNameArray
2210         https://bugs.webkit.org/show_bug.cgi?id=176867
2211
2212         Reviewed by Sam Weinig.
2213
2214         * bindings/js/JSDOMConvertRecord.h:
2215         * bindings/js/SerializedScriptValue.cpp:
2216         (WebCore::CloneSerializer::serialize):
2217         * bridge/NP_jsobject.cpp:
2218         (_NPN_Enumerate):
2219
2220 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
2221
2222         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
2223         https://bugs.webkit.org/show_bug.cgi?id=176824
2224         <rdar://problem/34290931>
2225
2226         Reviewed by Devin Rousso.
2227
2228         Tests: inspector/timeline/timeline-event-CancelAnimationFrame.html
2229                inspector/timeline/timeline-event-EventDispatch.html
2230                inspector/timeline/timeline-event-FireAnimationFrame.html
2231                inspector/timeline/timeline-event-RequestAnimationFrame.html
2232                inspector/timeline/timeline-event-TimerFire.html
2233                inspector/timeline/timeline-event-TimerInstall.html
2234                inspector/timeline/timeline-event-TimerRemove.html
2235
2236         * dom/EventTarget.cpp:
2237         (WebCore::EventTarget::fireEventListeners):
2238         * page/DOMWindow.cpp:
2239         (WebCore::DOMWindow::dispatchEvent):
2240         Include defaultPrevented when notifying inspector.
2241
2242         * inspector/InspectorInstrumentation.cpp:
2243         (WebCore::InspectorInstrumentation::didDispatchEventImpl):
2244         (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
2245         * inspector/InspectorInstrumentation.h:
2246         (WebCore::InspectorInstrumentation::didDispatchEvent):
2247         (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
2248         Pass defaultPrevented on to agent.
2249
2250         * inspector/InspectorTimelineAgent.cpp:
2251         (WebCore::InspectorTimelineAgent::didDispatchEvent):
2252         (WebCore::InspectorTimelineAgent::didLayout):
2253         (WebCore::InspectorTimelineAgent::didPaint):
2254         * inspector/InspectorTimelineAgent.h:
2255         * inspector/TimelineRecordFactory.cpp:
2256         (WebCore::TimelineRecordFactory::appendLayoutRoot):
2257         (WebCore::TimelineRecordFactory::appendDidDispatchEventData):
2258         * inspector/TimelineRecordFactory.h:
2259         Append a boolean defaultPrevented property on the EventDispatch timeline record's data.
2260
2261 2017-09-14  Maureen Daum  <mdaum@apple.com>
2262
2263         Introduce the option to mark an HTML element as having AutoFill available.
2264         https://bugs.webkit.org/show_bug.cgi?id=176710
2265
2266         Reviewed by Alex Christensen.
2267
2268         Introduce the option to mark an HTML element as having AutoFill available. Accessibility
2269         can use this property when deciding whether to announce that the focused field offers
2270         AutoFill.
2271
2272         * accessibility/AccessibilityObject.cpp:
2273         (WebCore::AccessibilityObject::isValueAutofillAvailable const):
2274         Check if the field is explicitly marked as having AutoFill available.
2275         * html/HTMLInputElement.cpp:
2276         (WebCore::HTMLInputElement::HTMLInputElement):
2277         * html/HTMLInputElement.h:
2278         (WebCore::HTMLInputElement::isAutoFillAvailable const):
2279         (WebCore::HTMLInputElement::setAutoFillAvailable):
2280
2281 2017-09-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2282
2283         [Curl] Move response related features into ResourceResponse
2284         https://bugs.webkit.org/show_bug.cgi?id=174654
2285
2286         Reviewed by Alex Christensen.
2287
2288         * platform/Curl.cmake:
2289         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2290         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
2291         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
2292         (WebCore::isHttpRedirect): Deleted.
2293         (WebCore::isHttpAuthentication): Deleted.
2294         (WebCore::isHttpNotModified): Deleted.
2295         (WebCore::isAppendableHeader): Deleted.
2296         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine): Deleted.
2297         * platform/network/curl/ResourceHandleCurlDelegate.h:
2298         * platform/network/curl/ResourceResponse.h:
2299         (WebCore::ResourceResponse::platformSuggestedFilename const): Deleted.
2300         * platform/network/curl/ResourceResponseCurl.cpp: Added.
2301         (WebCore::ResourceResponse::isAppendableHeader):
2302         (WebCore::ResourceResponse::appendHTTPHeaderField):
2303         (WebCore::ResourceResponse::setStatusLine):
2304         (WebCore::ResourceResponse::platformSuggestedFilename const):
2305         (WebCore::ResourceResponse::isRedirection const):
2306         (WebCore::ResourceResponse::isNotModified const):
2307         (WebCore::ResourceResponse::isUnauthorized const):
2308
2309 2017-09-13  Zalan Bujtas  <zalan@apple.com>
2310
2311         Switch multicolumn's spanner map from raw over to weak pointers.
2312         https://bugs.webkit.org/show_bug.cgi?id=176367
2313         <rdar://problem/34254896>
2314
2315         Reviewed by Antti Koivisto.
2316
2317         Test: fast/multicol/spanner-crash-when-adding-summary.html
2318
2319         * rendering/RenderMultiColumnFlowThread.cpp:
2320         (WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy):
2321         (WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted):
2322         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
2323         * rendering/RenderMultiColumnFlowThread.h:
2324         * rendering/RenderMultiColumnSet.cpp:
2325         (WebCore::RenderMultiColumnSet::firstRendererInFlowThread const):
2326         (WebCore::RenderMultiColumnSet::lastRendererInFlowThread const):
2327         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
2328         (WebCore::RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder):
2329         * rendering/RenderMultiColumnSpannerPlaceholder.h:
2330
2331 2017-09-13  John Wilander  <wilander@apple.com>
2332
2333         Introduce Storage Access API (document parts) as an experimental feature
2334         https://bugs.webkit.org/show_bug.cgi?id=175759
2335         <rdar://problem/34414107>
2336
2337         Reviewed by Alex Christensen.
2338
2339         Storage Access API is an experimental feature which allows cross-origin,
2340         sandboxed iframes to request access to their first-party storage (as
2341         opposed to partitioned storage). This might be restricted to cookies or
2342         might cover all stateful mechanisms.
2343
2344         It introduces the following three developer-facing things:
2345         - A new readonly attribute, document.hasStorageAccess.
2346         - A new function, document.requestStorageAccess().
2347         - A new iframe sandbox token, allow-storage-access-by-user-activation.
2348
2349         Tests: http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html
2350                http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
2351                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-iframe.html
2352                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
2353                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
2354                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
2355                http/tests/storageAccess/request-storage-access-same-origin-iframe.html
2356                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
2357                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html
2358                http/tests/storageAccess/request-storage-access-top-frame.html
2359
2360         * dom/Document.cpp:
2361         (WebCore::Document::requestStorageAccess):
2362         * dom/Document.h:
2363         (WebCore::Document::hasStorageAccess const):
2364         (WebCore::Document::setUserGrantsStorageAccessOverride):
2365             See comments on WebCore::Internals below.
2366         * dom/Document.idl:
2367         * dom/SecurityContext.cpp:
2368         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2369         (WebCore::SecurityContext::parseSandboxPolicy):
2370             Support for allow-storage-access-by-user-activation.
2371         * dom/SecurityContext.h:
2372         * loader/ResourceLoadObserver.cpp:
2373         (WebCore::ResourceLoadObserver::registerStorageAccess):
2374             Newly granted storage access is reported to 
2375             WebCore::ResourceLoadObserver.
2376         * loader/ResourceLoadObserver.h:
2377         * loader/ResourceLoadStatistics.cpp:
2378         (WebCore::encodeHashSet):
2379         (WebCore::ResourceLoadStatistics::encode const):
2380         (WebCore::decodeHashSet):
2381         (WebCore::ResourceLoadStatistics::decode):
2382         (WebCore::appendHashSet):
2383         (WebCore::ResourceLoadStatistics::toString const):
2384         (WebCore::mergeHashSet):
2385         (WebCore::ResourceLoadStatistics::merge):
2386             Storage of the new type of data.
2387         * loader/ResourceLoadStatistics.h:
2388         * page/Settings.in:
2389         * testing/Internals.cpp:
2390         (WebCore::Internals::resetToConsistentState):
2391         (WebCore::Internals::setUserGrantsStorageAccess):
2392         * testing/Internals.h:
2393         * testing/Internals.idl:
2394             Added setUserGrantsStorageAccess(). It is used to
2395             override the eventSender's keyboard input which
2396             always results in a cancel action on the confirm()
2397             dialog.
2398
2399 2017-09-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2400
2401         Submitting a form can cause HTMLFormElement's associated elements vector to be mutated during iteration
2402         https://bugs.webkit.org/show_bug.cgi?id=176368
2403         <rdar://problem/34254998>
2404
2405         Reviewed by Ryosuke Niwa.
2406
2407         In the process of iterating over form.associatedElements() during form submission in FormSubmission::create, the
2408         page may cause us to clobber the vector of FormAssociatedElements* we're currently iterating over by inserting
2409         new form controls beneath the form element we're in the process of submitting. This happens because
2410         FormSubmission::create calls HTMLTextAreaElement::appendFormData, which requires layout to be up to date, which
2411         in turn makes us updateLayout() and set focus, which fires a `change` event, upon which the page's JavaScript
2412         inserts additonal DOM nodes into the form, modifying the vector of associated elements.
2413
2414         To mitigate this, instead of iterating over HTMLFormElement::associatedElements(), which returns a reference to
2415         the HTMLFormElement's actual m_associatedElements vector, we iterate over a new vector of
2416         Ref<FormAssociatedElement>s created from m_associatedElements.
2417
2418         This patch also removes an event dispatch assertion added in r212026. This assertion was added to catch any
2419         other events dispatched in this scope, since dispatching events there would have had security implications, but
2420         after making iteration over associated elements robust, this NoEventDispatchAssertion is no longer useful.
2421
2422         Test: fast/forms/append-children-during-form-submission.html
2423
2424         * loader/FormSubmission.cpp:
2425         (WebCore::FormSubmission::create):
2426
2427 2017-09-13  Devin Rousso  <webkit@devinrousso.com>
2428
2429         Web Inspector: Event Listeners section does not update when listeners are added/removed
2430         https://bugs.webkit.org/show_bug.cgi?id=170570
2431         <rdar://problem/31501645>
2432
2433         Reviewed by Joseph Pecoraro.
2434
2435         Test: inspector/dom/event-listener-add-remove.html
2436
2437         * dom/EventTarget.cpp:
2438         (WebCore::EventTarget::setAttributeEventListener):
2439         Fire willRemoveEventListener/didAddEventListener events when an attribute event listener is
2440         replaced by another event listener.
2441
2442         * inspector/InspectorDOMAgent.h:
2443         * inspector/InspectorDOMAgent.cpp:
2444         (WebCore::InspectorDOMAgent::didAddEventListener):
2445         (WebCore::InspectorDOMAgent::willRemoveEventListener):
2446         Dispatch an event to the inspector frontend whenever an event listener is added/removed.
2447
2448         * inspector/InspectorInstrumentation.cpp:
2449         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
2450         (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl):
2451         Tie into existing instrumentation points for adding/removing event listeners.
2452
2453 2017-09-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2454
2455         [Curl] Bug fix for synchronous transfer
2456         https://bugs.webkit.org/show_bug.cgi?id=176552
2457
2458         Reviewed by Alex Christensen.
2459
2460         ResourceHandleInternal::m_delegate is null when transfer is synchronous. It should be set ResourceHandleCurlDelegate.
2461         Also the callback functions called when transfer is completed is wrong.
2462
2463         * platform/network/curl/ResourceHandleCurl.cpp:
2464         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2465         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2466         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
2467         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
2468         (WebCore::ResourceHandleCurlDelegate::notifyFail):
2469         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
2470         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
2471         (WebCore::ResourceHandleCurlDelegate::willSendData):
2472
2473 2017-09-13  Matt Lewis  <jlewis3@apple.com>
2474
2475         Unreviewed, rolling out r221976.
2476
2477         The test introduced was flaky from point of addition.
2478
2479         Reverted changeset:
2480
2481         "Introduce Storage Access API (document parts) as an
2482         experimental feature"
2483         https://bugs.webkit.org/show_bug.cgi?id=175759
2484         http://trac.webkit.org/changeset/221976
2485
2486 2017-09-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
2487
2488         Followup (r221805): Address comments and add more tests
2489         https://bugs.webkit.org/show_bug.cgi?id=176732
2490
2491         Reviewed by Darin Adler.
2492
2493         Test: http/tests/images/decode-slow-load-static-image.html
2494
2495         Code clean up and adding a new test to ensure multiple decode() promises
2496         can be resolved or rejected simultaneously without any issues.
2497
2498         * loader/ImageLoader.cpp:
2499         (WebCore::ImageLoader::decode):
2500         (WebCore::ImageLoader::decodeError):
2501         * loader/ImageLoader.h:
2502         * platform/graphics/BitmapImage.cpp:
2503         (WebCore::BitmapImage::decode):
2504         (WebCore::BitmapImage::callDecodingCallbacks):
2505         * platform/graphics/BitmapImage.h:
2506
2507 2017-09-13  Youenn Fablet  <youenn@apple.com>
2508
2509         Internals clearCacheStorageMemoryRepresentation should return a Promise
2510         https://bugs.webkit.org/show_bug.cgi?id=176818
2511
2512         Reviewed by Alex Christensen.
2513
2514         No observable change of behavior.
2515
2516         * Modules/cache/DOMCacheEngine.h:
2517         * testing/Internals.cpp:
2518         (WebCore::Internals::clearCacheStorageMemoryRepresentation): Returning a promise when clearing is completed.
2519         * testing/Internals.h:
2520         * testing/Internals.idl:
2521
2522 2017-09-13  Nikita Vasilyev  <nvasilyev@apple.com>
2523
2524         Web Inspector: Frontend should be made to expect and handle disabled properties
2525         https://bugs.webkit.org/show_bug.cgi?id=166787
2526         <rdar://problem/34379593>
2527
2528         Reviewed by Joseph Pecoraro.
2529
2530         Include disabled (commented out) CSS properties in the payload.
2531
2532         Tests: inspector/css/css-property.html
2533                inspector/css/matched-style-properties.html
2534
2535         * inspector/InspectorStyleSheet.cpp:
2536         (WebCore::InspectorStyle::populateAllProperties const):
2537         (WebCore::InspectorStyle::styleWithProperties const):
2538
2539 2017-09-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2540
2541         [GTK] Fails to build because 'Float32Array' has not been declared in AudioContext.h
2542         https://bugs.webkit.org/show_bug.cgi?id=176870
2543
2544         Reviewed by Konstantin Tokarev.
2545
2546         Add missing include of Float32Array.h
2547
2548         No new tests, its a build fix.
2549
2550         * Modules/webaudio/AudioContext.h:
2551
2552 2017-09-13  Andy Estes  <aestes@apple.com>
2553
2554         [CF] Upstream CFNetwork-related WebKitSystemInterface functions
2555         https://bugs.webkit.org/show_bug.cgi?id=176729
2556
2557         Reviewed by Alex Christensen.
2558
2559         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2560         * platform/mac/PublicSuffixMac.mm:
2561         (WebCore::isPublicSuffix):
2562         * platform/mac/WebCoreSystemInterface.h:
2563         * platform/mac/WebCoreSystemInterface.mm:
2564         * platform/network/cf/ResourceRequestCFNet.cpp:
2565         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2566         (WebCore::ResourceRequest::doUpdateResourceRequest):
2567         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2568         (WebCore::setCONNECTProxyForStream):
2569         (WebCore::SocketStreamHandleImpl::createStreams):
2570         (WebCore::setCONNECTProxyAuthorizationForStream):
2571         (WebCore::SocketStreamHandleImpl::addCONNECTCredentials):
2572         (WebCore::copyCONNECTProxyResponse):
2573         (WebCore::SocketStreamHandleImpl::readStreamCallback):
2574         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
2575         * platform/network/cocoa/ResourceRequestCocoa.mm:
2576         (WebCore::ResourceRequest::doUpdateResourceRequest):
2577         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2578
2579 2017-09-13  Antti Koivisto  <antti@apple.com>
2580
2581         Make more of the CSS animation system internals element based
2582         https://bugs.webkit.org/show_bug.cgi?id=176832
2583
2584         Reviewed by Zalan Bujtas.
2585
2586         CSS animations animate element style. Continue moving away from renderers in the animation code.
2587
2588         Also do some general modernization.
2589
2590         * css/CSSComputedStyleDeclaration.cpp:
2591         (WebCore::computeRenderStyleForProperty):
2592         * page/animation/AnimationBase.cpp:
2593         (WebCore::AnimationBase::AnimationBase):
2594         * page/animation/AnimationBase.h:
2595         * page/animation/CSSAnimationController.cpp:
2596         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
2597         (WebCore::CSSAnimationControllerPrivate::clear):
2598         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
2599         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForElement):
2600         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
2601         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
2602         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
2603         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
2604         (WebCore::CSSAnimationControllerPrivate::animatedStyleForElement):
2605         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
2606         (WebCore::CSSAnimationController::cancelAnimations):
2607         (WebCore::CSSAnimationController::updateAnimations):
2608         (WebCore::CSSAnimationController::animatedStyleForRenderer):
2609         (WebCore::CSSAnimationController::computeExtentOfAnimation const):
2610         (WebCore::CSSAnimationController::pauseAnimationAtTime):
2611         (WebCore::CSSAnimationController::pauseTransitionAtTime):
2612         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForRenderer): Deleted.
2613         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer): Deleted.
2614         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer): Deleted.
2615         * page/animation/CSSAnimationController.h:
2616         * page/animation/CSSAnimationControllerPrivate.h:
2617         * page/animation/CompositeAnimation.cpp:
2618         (WebCore::CompositeAnimation::~CompositeAnimation):
2619         (WebCore::CompositeAnimation::clearElement):
2620         (WebCore::CompositeAnimation::updateTransitions):
2621         (WebCore::CompositeAnimation::updateKeyframeAnimations):
2622         (WebCore::CompositeAnimation::animate):
2623         (WebCore::CompositeAnimation::clearRenderer): Deleted.
2624         * page/animation/CompositeAnimation.h:
2625         * page/animation/ImplicitAnimation.cpp:
2626         (WebCore::ImplicitAnimation::ImplicitAnimation):
2627         (WebCore::ImplicitAnimation::animate):
2628         * page/animation/ImplicitAnimation.h:
2629         (WebCore::ImplicitAnimation::create):
2630         * page/animation/KeyframeAnimation.cpp:
2631         (WebCore::KeyframeAnimation::KeyframeAnimation):
2632         (WebCore::KeyframeAnimation::animate):
2633         * page/animation/KeyframeAnimation.h:
2634         * rendering/RenderElement.cpp:
2635         (WebCore::RenderElement::willBeDestroyed):
2636         * rendering/RenderLayer.cpp:
2637         (WebCore::RenderLayer::currentTransform const):
2638         * style/RenderTreeUpdater.cpp:
2639         (WebCore::RenderTreeUpdater::createRenderer):
2640         * style/StyleTreeResolver.cpp:
2641         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2642         * testing/Internals.cpp:
2643         (WebCore::Internals::pauseAnimationAtTimeOnElement):
2644         (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
2645         (WebCore::Internals::pauseTransitionAtTimeOnElement):
2646         (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):
2647
2648 2017-09-13  Daniel Bates  <dabates@apple.com>
2649
2650         Make history.pushState()/replaceState() more closely aligned to the HTML standard
2651         https://bugs.webkit.org/show_bug.cgi?id=176730
2652         <rdar://problem/33839265>
2653
2654         Reviewed by Alex Christensen.
2655
2656         Update history.pushState()/replaceState() to more closely align with the algorithm
2657         specified in <https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate-2> (9 September 2017).
2658
2659         Test: http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html
2660
2661         * page/History.cpp:
2662         (WebCore::History::stateObjectAdded):
2663         * page/SecurityOrigin.cpp:
2664         (WebCore::SecurityOrigin::extractInnerURL): Use URL constructor that takes a base URL as opposed
2665         to using the special ParsedURLString-variant because the latter can only be used to parse a string
2666         returned from URL::string(). And the extracted inner URL does not meet this criterion. Using the
2667         ParsedURLString-variant of the URL constructor with a string that is not the result of URL::string()
2668         will cause an assertion failure in a debug build.
2669
2670 2017-09-13  John Wilander  <wilander@apple.com>
2671
2672         Introduce Storage Access API (document parts) as an experimental feature
2673         https://bugs.webkit.org/show_bug.cgi?id=175759
2674         <rdar://problem/33666847>
2675
2676         Reviewed by Alex Christensen.
2677
2678         Storage Access API is an experimental feature which allows cross-origin,
2679         sandboxed iframes to request access to their first-party storage (as
2680         opposed to partitioned storage). This might be restricted to cookies or
2681         might cover all stateful mechanisms.
2682
2683         It introduces the following three developer-facing things:
2684         - A new readonly attribute, document.hasStorageAccess.
2685         - A new function, document.requestStorageAccess().
2686         - A new iframe sandbox token, allow-storage-access-by-user-activation.
2687
2688         Tests: http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-iframe.html
2689                http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
2690                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-iframe.html
2691                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
2692                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
2693                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
2694                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-iframe.html
2695                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
2696                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe.html
2697                http/tests/loading/resourceLoadStatistics/request-storage-access-top-frame.html
2698
2699         * dom/Document.cpp:
2700         (WebCore::Document::requestStorageAccess):
2701         * dom/Document.h:
2702         (WebCore::Document::hasStorageAccess const):
2703         (WebCore::Document::setUserGrantsStorageAccessOverride):
2704             See comments on WebCore::Internals below.
2705         * dom/Document.idl:
2706         * dom/SecurityContext.cpp:
2707         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2708         (WebCore::SecurityContext::parseSandboxPolicy):
2709             Support for allow-storage-access-by-user-activation.
2710         * dom/SecurityContext.h:
2711         * loader/ResourceLoadObserver.cpp:
2712         (WebCore::ResourceLoadObserver::registerStorageAccess):
2713             Newly granted storage access is reported to 
2714             WebCore::ResourceLoadObserver.
2715         * loader/ResourceLoadObserver.h:
2716         * loader/ResourceLoadStatistics.cpp:
2717         (WebCore::encodeHashSet):
2718         (WebCore::ResourceLoadStatistics::encode const):
2719         (WebCore::decodeHashSet):
2720         (WebCore::ResourceLoadStatistics::decode):
2721         (WebCore::appendHashSet):
2722         (WebCore::ResourceLoadStatistics::toString const):
2723         (WebCore::mergeHashSet):
2724         (WebCore::ResourceLoadStatistics::merge):
2725             Storage of the new type of data.
2726         * loader/ResourceLoadStatistics.h:
2727         * page/Settings.in:
2728         * testing/Internals.cpp:
2729         (WebCore::Internals::resetToConsistentState):
2730         (WebCore::Internals::setUserGrantsStorageAccess):
2731         * testing/Internals.h:
2732         * testing/Internals.idl:
2733             Added setUserGrantsStorageAccess(). It is used to
2734             override the eventSender's keyboard input which
2735             always results in a cancel action on the confirm()
2736             dialog.
2737
2738 2017-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2739
2740         [HarfBuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition in some cases
2741         https://bugs.webkit.org/show_bug.cgi?id=176848
2742
2743         Reviewed by Michael Catanzaro.
2744
2745         This patch rewrites HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition() to make it simpler and ensure we
2746         return the right offset in all the cases, also honoring now the includePartialGlyphs parameter that we were
2747         ignoring in FontCascade::offsetForPositionForComplexText().
2748
2749         Fixes several tests that started to fail after r221909.
2750
2751         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2752         (WebCore::FontCascade::offsetForPositionForComplexText const):
2753         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2754         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
2755         (WebCore::HarfBuzzShaper::offsetForPosition):
2756         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
2757
2758 2017-09-13  Per Arne Vollan  <pvollan@apple.com>
2759
2760         Initialize InternalSettings member variable.
2761         https://bugs.webkit.org/show_bug.cgi?id=176838
2762
2763         Reviewed by Brent Fulgham.
2764
2765         Initialize the m_webVREnabled member in the constructor.
2766
2767         * testing/InternalSettings.cpp:
2768         (WebCore::InternalSettings::Backup::Backup):
2769
2770 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
2771
2772         Make WebGLRenderingContextBase::TypedList::data() const-correct.
2773         https://bugs.webkit.org/show_bug.cgi?id=176833
2774
2775         Reviewed by Sam Weinig.
2776
2777         No change of behavior.
2778
2779         * html/canvas/WebGLRenderingContextBase.cpp:
2780         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
2781         * html/canvas/WebGLRenderingContextBase.h:
2782         (WebCore::WebGLRenderingContextBase::TypedList::data const):
2783         * platform/graphics/GraphicsContext3D.h:
2784         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2785         (WebCore::GraphicsContext3D::uniform1fv):
2786         (WebCore::GraphicsContext3D::uniform2fv):
2787         (WebCore::GraphicsContext3D::uniform3fv):
2788         (WebCore::GraphicsContext3D::uniform4fv):
2789         (WebCore::GraphicsContext3D::uniform1iv):
2790         (WebCore::GraphicsContext3D::uniform2iv):
2791         (WebCore::GraphicsContext3D::uniform3iv):
2792         (WebCore::GraphicsContext3D::uniform4iv):
2793         (WebCore::GraphicsContext3D::uniformMatrix2fv):
2794         (WebCore::GraphicsContext3D::uniformMatrix3fv):
2795         (WebCore::GraphicsContext3D::uniformMatrix4fv):
2796         (WebCore::GraphicsContext3D::vertexAttrib1fv):
2797         (WebCore::GraphicsContext3D::vertexAttrib2fv):
2798         (WebCore::GraphicsContext3D::vertexAttrib3fv):
2799         (WebCore::GraphicsContext3D::vertexAttrib4fv):
2800
2801 2017-09-13  Sam Weinig  <sam@webkit.org>
2802
2803         Remove CanvasRenderingContext2D.commit(), it is a no-op and not part the standard
2804         https://bugs.webkit.org/show_bug.cgi?id=176821
2805
2806         Reviewed by Darin Adler.
2807
2808         * html/canvas/CanvasRenderingContext2D.h:
2809         * html/canvas/CanvasRenderingContext2D.idl:
2810         
2811             Remove the commit operation. It is no longer part the standard (it was
2812             moved to OffscreenCanvasRenderingContext2D) and it was a no-op.
2813
2814 2017-09-12  Matt Rajca  <mrajca@apple.com>
2815
2816         Ensure the user interacted with the page before setting m_userHasInteractedWithMediaElement
2817         https://bugs.webkit.org/show_bug.cgi?id=176816
2818
2819         Reviewed by Eric Carlson.
2820
2821         Currently, when the user presses a keyboard shortcut in the client to reload a page, that may
2822         get registered as a user gesture on the reloaded page. Before setting the
2823         m_userHasInteractedWithMediaElement flag, we should check if a user gesture was actually handled
2824         by checking the userDidInteractWithPage flag. In case of key events that aren't handled by the
2825         page, this will be set to false by EventHandler:
2826
2827             // If the key event was not handled, do not treat it as user interaction with the page.
2828             if (topDocument && !wasHandled)
2829                 topDocument->setUserDidInteractWithPage(savedUserDidInteractWithPage);
2830
2831         We need to revisit this in the future in webkit.org/b/176817 and ensure user gesture tokens
2832         don't carry over across reloads of the page.
2833
2834         Tests: I wasn't able to trigger the pathological scenario this aims to fix with a test that calls
2835         window.location.reload() from a synthetic keyDown event.
2836
2837         * dom/Document.cpp:
2838         (WebCore::Document::noteUserInteractionWithMediaElement):
2839
2840 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
2841
2842         Disallow passing null values to various WebGL2 methods.
2843         https://bugs.webkit.org/show_bug.cgi?id=176829
2844
2845         Reviewed by Yusuke Suzuki.
2846
2847         This matches the specification as well as Gecko and Chromium.
2848
2849         Test: fast/canvas/webgl/webgl2/bindings.html
2850
2851         * html/canvas/WebGL2RenderingContext.cpp:
2852         (WebCore::WebGL2RenderingContext::beginQuery):
2853         (WebCore::WebGL2RenderingContext::getQueryParameter):
2854         (WebCore::WebGL2RenderingContext::samplerParameteri):
2855         (WebCore::WebGL2RenderingContext::samplerParameterf):
2856         (WebCore::WebGL2RenderingContext::getSamplerParameter):
2857         (WebCore::WebGL2RenderingContext::clientWaitSync):
2858         (WebCore::WebGL2RenderingContext::waitSync):
2859         (WebCore::WebGL2RenderingContext::getSyncParameter):
2860         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
2861         (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
2862         (WebCore::WebGL2RenderingContext::getUniformIndices):
2863         (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
2864         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
2865         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
2866         (WebCore::WebGL2RenderingContext::uniformBlockBinding):
2867         * html/canvas/WebGL2RenderingContext.h:
2868         * html/canvas/WebGL2RenderingContext.idl:
2869
2870 2017-09-13  Sergio Villar Senin  <svillar@igalia.com>
2871
2872         [WebVR] Add IDLs and stubs
2873         https://bugs.webkit.org/show_bug.cgi?id=174202
2874
2875         Reviewed by Dean Jackson.
2876
2877         Adding the complete set of IDLs for the WebVR 1.1 spec including the interface stubs which
2878         currently do nothing.
2879
2880         Tests: webvr/webvr-disabled.html
2881                webvr/webvr-enabled.html
2882
2883         * CMakeLists.txt:
2884         * DerivedSources.make:
2885         * Modules/webvr/DOMWindowWebVR.idl: Added.
2886         * Modules/webvr/GamepadWebVR.cpp: Added.
2887         (WebCore::GamepadWebVR::GamepadWebVR):
2888         (WebCore::GamepadWebVR::~GamepadWebVR):
2889         (WebCore::GamepadWebVR::displayId):
2890         * Modules/webvr/GamepadWebVR.h: Added.
2891         * Modules/webvr/GamepadWebVR.idl: Added.
2892         * Modules/webvr/NavigatorWebVR.cpp: Added.
2893         (WebCore::NavigatorWebVR::getVRDisplays):
2894         (WebCore::NavigatorWebVR::activeVRDisplays):
2895         (WebCore::NavigatorWebVR::vrEnabled):
2896         * Modules/webvr/NavigatorWebVR.h: Added.
2897         * Modules/webvr/NavigatorWebVR.idl: Added.
2898         * Modules/webvr/VRDisplay.cpp: Added.
2899         (WebCore::VRDisplay::create):
2900         (WebCore::VRDisplay::VRDisplay):
2901         (WebCore::VRDisplay::isConnected const):
2902         (WebCore::VRDisplay::isPresenting const):
2903         (WebCore::VRDisplay::capabilities const):
2904         (WebCore::VRDisplay::stageParameters const):
2905         (WebCore::VRDisplay::getEyeParameters const):
2906         (WebCore::VRDisplay::displayId const):
2907         (WebCore::VRDisplay::displayName const):
2908         (WebCore::VRDisplay::getFrameData const):
2909         (WebCore::VRDisplay::getPose const):
2910         (WebCore::VRDisplay::resetPose):
2911         (WebCore::VRDisplay::depthNear const):
2912         (WebCore::VRDisplay::setDepthNear):
2913         (WebCore::VRDisplay::depthFar const):
2914         (WebCore::VRDisplay::setDepthFar):
2915         (WebCore::VRDisplay::requestAnimationFrame):
2916         (WebCore::VRDisplay::cancelAnimationFrame):
2917         (WebCore::VRDisplay::requestPresent):
2918         (WebCore::VRDisplay::exitPresent):
2919         (WebCore::VRDisplay::getLayers const):
2920         (WebCore::VRDisplay::submitFrame):
2921         (WebCore::VRDisplay::hasPendingActivity const):
2922         (WebCore::VRDisplay::activeDOMObjectName const):
2923         (WebCore::VRDisplay::canSuspendForDocumentSuspension const):
2924         (WebCore::VRDisplay::stop):
2925         * Modules/webvr/VRDisplay.h: Added.
2926         * Modules/webvr/VRDisplay.idl: Added.
2927         * Modules/webvr/VRDisplayCapabilities.cpp: Added.
2928         (WebCore::VRDisplayCapabilities::hasPosition const):
2929         (WebCore::VRDisplayCapabilities::hasOrientation const):
2930         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2931         (WebCore::VRDisplayCapabilities::canPresent const):
2932         (WebCore::VRDisplayCapabilities::maxLayer const):
2933         * Modules/webvr/VRDisplayCapabilities.h: Added.
2934         (WebCore::VRDisplayCapabilities::create):
2935         * Modules/webvr/VRDisplayCapabilities.idl: Added.
2936         * Modules/webvr/VRDisplayEvent.cpp: Added.
2937         (WebCore::VRDisplayEvent::VRDisplayEvent):
2938         (WebCore::VRDisplayEvent::display const):
2939         (WebCore::VRDisplayEvent::reason const):
2940         (WebCore::VRDisplayEvent::eventInterface const):
2941         * Modules/webvr/VRDisplayEvent.h: Added.
2942         * Modules/webvr/VRDisplayEvent.idl: Added.
2943         * Modules/webvr/VRDisplayEventReason.h: Added.
2944         * Modules/webvr/VRDisplayEventReason.idl: Added.
2945         * Modules/webvr/VREye.h: Added.
2946         * Modules/webvr/VREye.idl: Added.
2947         * Modules/webvr/VREyeParameters.cpp: Added.
2948         (WebCore::VREyeParameters::VREyeParameters):
2949         (WebCore::VREyeParameters::offset const):
2950         (WebCore::VREyeParameters::fieldOfView const):
2951         (WebCore::VREyeParameters::renderWidth const):
2952         (WebCore::VREyeParameters::renderHeight const):
2953         * Modules/webvr/VREyeParameters.h: Added.
2954         (WebCore::VREyeParameters::create):
2955         * Modules/webvr/VREyeParameters.idl: Added.
2956         * Modules/webvr/VRFieldOfView.cpp: Added.
2957         (WebCore::VRFieldOfView::upDegrees const):
2958         (WebCore::VRFieldOfView::rightDegrees const):
2959         (WebCore::VRFieldOfView::downDegrees const):
2960         (WebCore::VRFieldOfView::leftDegrees const):
2961         * Modules/webvr/VRFieldOfView.h: Added.
2962         (WebCore::VRFieldOfView::create):
2963         * Modules/webvr/VRFieldOfView.idl: Added.
2964         * Modules/webvr/VRFrameData.cpp: Added.
2965         (WebCore::VRFrameData::VRFrameData):
2966         (WebCore::VRFrameData::timestamp const):
2967         (WebCore::VRFrameData::leftProjectionMatrix const):
2968         (WebCore::VRFrameData::leftViewMatrix const):
2969         (WebCore::VRFrameData::rightProjectionMatrix const):
2970         (WebCore::VRFrameData::rightViewMatrix const):
2971         (WebCore::VRFrameData::pose const):
2972         * Modules/webvr/VRFrameData.h: Added.
2973         (WebCore::VRFrameData::create):
2974         * Modules/webvr/VRFrameData.idl: Added.
2975         * Modules/webvr/VRLayerInit.h: Added.
2976         * Modules/webvr/VRLayerInit.idl: Added.
2977         * Modules/webvr/VRPose.cpp: Added.
2978         (WebCore::VRPose::position const):
2979         (WebCore::VRPose::linearVelocity const):
2980         (WebCore::VRPose::linearAcceleration const):
2981         (WebCore::VRPose::orientation const):
2982         (WebCore::VRPose::angularVelocity const):
2983         (WebCore::VRPose::angularAcceleration const):
2984         * Modules/webvr/VRPose.h: Added.
2985         (WebCore::VRPose::create):
2986         * Modules/webvr/VRPose.idl: Added.
2987         * Modules/webvr/VRStageParameters.cpp: Added.
2988         (WebCore::VRStageParameters::sittingToStandingTransform const):
2989         (WebCore::VRStageParameters::sizeX const):
2990         (WebCore::VRStageParameters::sizeZ const):
2991         * Modules/webvr/VRStageParameters.h: Added.
2992         (WebCore::VRStageParameters::create):
2993         * Modules/webvr/VRStageParameters.idl: Added.
2994         * WebCore.xcodeproj/project.pbxproj:
2995         * bindings/js/WebCoreBuiltinNames.h:
2996         * dom/EventNames.h:
2997         * dom/EventNames.in:
2998         * dom/EventTargetFactory.in:
2999         * features.json:
3000         * page/RuntimeEnabledFeatures.h:
3001         (WebCore::RuntimeEnabledFeatures::setWebVREnabled):
3002         (WebCore::RuntimeEnabledFeatures::webVREnabled const):
3003         * testing/InternalSettings.cpp:
3004         (WebCore::InternalSettings::Backup::restoreTo):
3005         (WebCore::InternalSettings::setWebVREnabled):
3006         * testing/InternalSettings.h:
3007         * testing/InternalSettings.idl:
3008
3009 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
3010
3011         Update the type of the texture argument to framebufferTextureLayer().
3012         https://bugs.webkit.org/show_bug.cgi?id=176785
3013
3014         Reviewed by Yusuke Suzuki.
3015
3016         This matches the specification as well as Gecko and Chromium.
3017
3018         Also move getInternalformatParameter() to the position it has in the
3019         specification, for easier comparison.
3020
3021         Test: fast/canvas/webgl/webgl2/bindings.html
3022
3023         * html/canvas/WebGL2RenderingContext.cpp:
3024         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
3025         * html/canvas/WebGL2RenderingContext.h:
3026         * html/canvas/WebGL2RenderingContext.idl:
3027
3028 2017-09-13  Zan Dobersek  <zdobersek@igalia.com>
3029
3030         [EME] Implement CDMInstanceClearKey::updateLicense()
3031         https://bugs.webkit.org/show_bug.cgi?id=176791
3032
3033         Reviewed by Xabier Rodriguez-Calvar.
3034
3035         Implement the updateLicense() method for CDMInstanceClearKey.
3036         The response data is parsed as JSON, matching that agains either
3037         'license' or 'license release acknowledgement' formats (depending
3038         on either 'keys' or 'kids' object keys being present). If any
3039         format is recognized, appropriate steps are taken.
3040
3041         In case of the 'license' format, the passed-in keys are matched
3042         against existing ones. If some keys have changed or have been
3043         newly introduced, the key information is sorted by key ID size
3044         and data to enforce order. After that the KeyStatusVector object
3045         is constructed, containing key ID and status information for all
3046         the keys associated with this session. Finally callback is
3047         dispatched, signalling a successful operation and passing the
3048         KeyStatusVector, if any, back to the caller.
3049
3050         In case of the 'license release acknowledgement' format, the
3051         session data for this session ID is removed from the ClearKey state
3052         singleton. The callback is dispatched signalling the session closure
3053         and successfull completion of the operation.
3054
3055         Finally, if no format is deduced, the callback is again dispatched,
3056         but now signalling an operation failure.
3057
3058         No new tests -- expectations for the relevant tests are updated
3059         to reflect the introduced changes.
3060
3061         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3062         (WebCore::ClearKeyState::keys):
3063         (WebCore::ClearKeyState::singleton):
3064         (WebCore::parseLicenseFormat):
3065         (WebCore::parseLicenseReleaseAcknowledgementFormat):
3066         (WebCore::CDMInstanceClearKey::updateLicense):
3067
3068 2017-09-13  Ryosuke Niwa  <rniwa@webkit.org>
3069
3070         Refactor WebContentReader out of EditorMac and EditorIOS
3071         https://bugs.webkit.org/show_bug.cgi?id=176770
3072
3073         Reviewed by Sam Weinig.
3074
3075         Extracted WebContentReader.h, WebContentReaderMac.mm, and WebContentIOS.mm from Pasteboard.h,
3076         EditorMac.mm, and EditorIOS.mm respectively.
3077
3078         Also moved createFragmentAndAddResources from EditorCocoa.mm to WebContentReaderCocoa.mm
3079         and createFragmentForImageAndURL and createFragmentForImageResourceAndAddResource to markup.cpp.
3080
3081         * Configurations/WebCore.xcconfig:
3082         * PlatformMac.cmake:
3083         * WebCore.xcodeproj/project.pbxproj:
3084         * editing/Editor.cpp:
3085         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
3086         * editing/Editor.h:
3087         * editing/WebContentReader.h: Added.
3088         * editing/cocoa/EditorCocoa.mm:
3089         (WebCore::Editor::replaceSelectionWithAttributedString):
3090         (WebCore::Editor::createFragment): Deleted.
3091         (WebCore::Editor::createFragmentForImageResourceAndAddResource): Deleted.
3092         (WebCore::Editor::createFragmentAndAddResources): Deleted.
3093         * editing/cocoa/WebContentReaderCocoa.mm: Added.
3094         (WebCore::createFragmentForImageResourceAndAddResource):
3095         (WebCore::createFragment):
3096         (WebCore::createFragmentAndAddResources):
3097         * editing/ios/EditorIOS.mm:
3098         (WebCore::Editor::WebContentReader): Moved to WebContentReaderIOS.mm.
3099         * editing/ios/WebContentReaderIOS.mm: Added.
3100         (WebCore::WebContentReader::addFragment):
3101         (WebCore::WebContentReader::readWebArchive):
3102         (WebCore::WebContentReader::readFilenames):
3103         (WebCore::WebContentReader::readHTML):
3104         (WebCore::WebContentReader::readRTFD):
3105         (WebCore::WebContentReader::readRTF):
3106         (WebCore::WebContentReader::readImage):
3107         (WebCore::WebContentReader::readURL):
3108         (WebCore::WebContentReader::readPlainText):
3109         * editing/mac/EditorMac.mm:
3110         (WebCore::Editor::WebContentReader): Moved to WebContentReaderMac.mm.
3111         * editing/mac/WebContentReaderMac.mm: Added.
3112         (WebCore::WebContentReader::readWebArchive):
3113         (WebCore::WebContentReader::readFilenames):
3114         (WebCore::WebContentReader::readHTML):
3115         (WebCore::WebContentReader::readRTFD):
3116         (WebCore::WebContentReader::readRTF):
3117         (WebCore::WebContentReader::readImage):
3118         (WebCore::WebContentReader::readURL):
3119         (WebCore::WebContentReader::readPlainText):
3120         * editing/markup.cpp:
3121         (WebCore::createFragmentForImageAndURL):
3122         (WebCore::createFragmentForImageResourceAndAddResource):
3123         * editing/markup.h:
3124
3125 2017-09-12  Yusuke Suzuki  <utatane.tea@gmail.com>
3126
3127         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
3128         https://bugs.webkit.org/show_bug.cgi?id=176010
3129
3130         Reviewed by Filip Pizlo.
3131
3132         * platform/network/curl/CurlJobManager.cpp:
3133         (WebCore::CurlJobList::finishJobs):
3134
3135 2017-09-12  Frederic Wang  <fwang@igalia.com>
3136
3137         Rename isRootLayer to isRenderViewLayer
3138         https://bugs.webkit.org/show_bug.cgi?id=176684
3139
3140         Reviewed by Darin Adler.
3141
3142         This patch was generated with the help of do-webcore-rename with some coding style adjustment.
3143
3144         No new tests, behavior unchanged.
3145
3146         * rendering/RenderLayer.cpp:
3147         (WebCore::RenderLayer::RenderLayer):
3148         (WebCore::RenderLayer::enclosingTransformedAncestor const):
3149         (WebCore::RenderLayer::enclosingFilterRepaintLayer const):
3150         (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
3151         (WebCore::RenderLayer::clippingRootForPainting const):
3152         (WebCore::RenderLayer::beginTransparencyLayers):
3153         (WebCore::shouldSuppressPaintingLayer):
3154         (WebCore::RenderLayer::paintFixedLayersInNamedFlows):
3155         (WebCore::RenderLayer::hitTest):
3156         (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
3157         (WebCore::RenderLayer::calculateClipRects const):
3158         * rendering/RenderLayer.h:
3159         * rendering/RenderLayerBacking.cpp:
3160         (WebCore::RenderLayerBacking::RenderLayerBacking):
3161         (WebCore::RenderLayerBacking::updateConfiguration):
3162         (WebCore::RenderLayerBacking::updateAfterDescendants):
3163         (WebCore::RenderLayerBacking::paintsIntoWindow const):
3164         (WebCore::RenderLayerBacking::paintIntoLayer):
3165         * rendering/RenderLayerCompositor.cpp:
3166         (WebCore::RenderLayerCompositor::logLayerInfo):
3167         (WebCore::RenderLayerCompositor::needsCompositingUpdateForStyleChangeOnNonCompositedLayer const):
3168         (WebCore::RenderLayerCompositor::updateBacking):
3169         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
3170         (WebCore::RenderLayerCompositor::addToOverlapMap):
3171         (WebCore::RenderLayerCompositor::computeCompositingRequirementsForNamedFlowFixed):
3172         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3173         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTreeForNamedFlowFixed):
3174         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
3175         (WebCore::RenderLayerCompositor::needsToBeComposited const):
3176         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const): Also move the IOS condition
3177         up to avoid that check-webkit-style complains.
3178         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
3179         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
3180         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
3181         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3182
3183 2017-09-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3184
3185         [iOS DnD] Support DataTransfer.getData and DataTransfer.setData when dragging or dropping
3186         https://bugs.webkit.org/show_bug.cgi?id=176672
3187         <rdar://problem/34353723>
3188
3189         Reviewed by Ryosuke Niwa.
3190
3191         Makes several tweaks to support DataTransfer.getData and DataTransfer.setData when dragging and dropping on iOS.
3192         See per-method changes below for more details. This patch also renames some old variable and property names
3193         along the way, so they no longer reference "data interaction", and instead refer to the feature by its post-WWDC
3194         name.
3195
3196         New test: DataInteractionTests.ExternalSourceInlineTextToFileInput
3197         Modified: DataInteractionTests.CanStartDragOnDivWithDraggableAttribute
3198                   DataInteractionTests.SinglePlainTextURLTypeIdentifiers
3199                   DataInteractionTests.SinglePlainTextWordTypeIdentifiers
3200
3201         * platform/ios/AbstractPasteboard.h:
3202         * platform/ios/PasteboardIOS.mm:
3203         (WebCore::cocoaTypeFromHTMLClipboardType):
3204
3205         In cocoaTypeFromHTMLClipboardType, map the "text/plain" MIME type to the "public.plain-text" UTI. Previously,
3206         this corresponded to "public.text", which is incorrect, since "public.text" also includes non-plain-text types
3207         such as "public.html", thereby confusing NSItemProviders. Importantly, this makes it so that plain text strings
3208         written via DataTransfer.setData() can actually be read back as a cocoa value, since "public.plain-text" is one
3209         of the UTIs in +[NSString readableTypeIdentifiersForItemProvider].
3210
3211         (WebCore::Pasteboard::writeString):
3212
3213         Instead of writing { type : data } to the pasteboard, write { cocoaType : data }. It appears that this was
3214         changed unintentionally in r156588 when upstreaming the iOS pasteboard implementation. This is made apparent by
3215         how Pasteboard::readString() requests the cocoa UTI from the platform pasteboard, but Pasteboard::writeString()
3216         sends the MIME type.
3217
3218         * platform/ios/PlatformPasteboardIOS.mm:
3219         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
3220         (WebCore::PlatformPasteboard::write):
3221
3222         When writing plain text or a URL, specify that the item wants inline style representation. This prevents odd and
3223         unexpected behaviors (for instance, being able to drag plain text into the Files app as a file), but it also
3224         makes getData() not bail and return the null string on drop, due to forFileDrag() being true in
3225         DataTransfer::getData().
3226
3227         * platform/ios/WebItemProviderPasteboard.h:
3228         * platform/ios/WebItemProviderPasteboard.mm:
3229         (-[WebItemProviderRegistrationInfoList init]):
3230         (uiPreferredPresentationStyle):
3231         (-[WebItemProviderRegistrationInfoList itemProvider]):
3232
3233         Set the preferred presentation style when generating an item provider from a registration list.
3234
3235         (+[WebItemProviderLoadResult emptyLoadResult]):
3236         (+[WebItemProviderLoadResult loadResultWithFileURLMap:presentationStyle:]):
3237         (-[WebItemProviderLoadResult initWithFileURLMap:presentationStyle:]):
3238         (-[WebItemProviderLoadResult fileURLForType:]):
3239         (-[WebItemProviderLoadResult loadedFileURLs]):
3240         (-[WebItemProviderLoadResult loadedTypeIdentifiers]):
3241
3242         Introduce WebItemProviderLoadResult, an object that encapsulates information needed to represent the contents of
3243         an NSItemProvider dropped in web content. Previously, WebItemProviderPasteboard maintained an array of
3244         dictionaries of UTI => file URL, where each dictionary represents where the dropped data for a given item
3245         provider lives. Now that we additionally need to remember (for each item provider) whether we should consider
3246         its data as a file upload, it's more helpful to have a separate object representing the "load results" of a
3247         dropped item provider.
3248
3249         (-[WebItemProviderPasteboard init]):
3250         (-[WebItemProviderPasteboard pasteboardTypes]):
3251         (-[WebItemProviderPasteboard setItemProviders:]):
3252         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
3253         (-[WebItemProviderPasteboard droppedFileURLs]):
3254
3255         Respect item provider load results that should not be exposed as a file to the page.
3256
3257         (-[WebItemProviderPasteboard numberOfFiles]):
3258
3259         Respect item providers with UIPreferredPresentationStyleInline by not counting them towards the number of files.
3260
3261         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3262
3263         Adjust for the transition from an array of dictionaries representing loaded item providers to an array of
3264         WebItemProviderLoadResults.
3265
3266         (-[WebItemProviderPasteboard fileURLsForDataInteraction]): Deleted.
3267         * platform/mac/DragDataMac.mm:
3268         (WebCore::DragData::containsFiles const):
3269
3270         DragData::containsFiles previously only considered whether or not particular UTIs appear in the pasteboard. In
3271         the case of Mac, this is NSFilesPromisePboardType and NSFilenamesPboardType, but in the case of iOS, this is a
3272         much broader category (anything conforming to "public.content"), since files are not exposed explicitly as
3273         "promise" or "file" types in the list of registered UTIs. This caused us to always bail in
3274         DataTransfer.getData() on drop on iOS, since we will always believe there's a file on the pasteboard if there's
3275         anything conforming to "public.content" at all.
3276
3277         To fix this and simplify the code at the same time, we simply replace the currently implementation of
3278         DragData::containsFiles to return true iff the number of files is nonzero. On Mac, DragData::numberOfFiles
3279         checks the same UTIs as DragData::containsFiles (NSFilesPromisePboardType and NSFilenamesPboardType), but
3280         additionally counts the number of file URLs corresponding to those UTIs.
3281
3282         On iOS, the implementation of numberOfFiles is new to iOS 11, and relevant only in the drag and drop flow.
3283         Previously, we would consider an item provider to "contain" a file if it had a UTI conforming to one of the UTIs
3284         acceptable for drag and drop (at the time of writing, these are ["public.content", "public.zip",
3285         "public.folder"]). With this patch, anything conforming to these UTIs will continue to be represented as files,
3286         but importantly, if an item provider indicates that it should be represented inline (i.e. a plain text
3287         selection), then we don't consider that item provider as vending a file. This allows us to distinguish between
3288         cases where we are dragging a plain text selection over a file input, and when we are dragging a plain text file.
3289         In both cases, "public.plain-text" is offered as a registered UTI, but in the former, the item provider should
3290         indicate that inline presentation style is preferred. Refer to <rdar://problem/32202542> for more details.
3291
3292 2017-09-12  Joseph Pecoraro  <pecoraro@apple.com>
3293
3294         QualifiedName::init should assume AtomicStrings::init was already called
3295         https://bugs.webkit.org/show_bug.cgi?id=176639
3296
3297         Reviewed by Sam Weinig.
3298
3299         * dom/QualifiedName.cpp:
3300         (WebCore::QualifiedName::init):
3301         All callers of QualifiedName::init precede it with their own call to
3302         AtomicString::init, so QualifiedName doesn't need to do it.
3303
3304 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
3305
3306         Unskip fast/text/system-font-synthetic-italic.html
3307         https://bugs.webkit.org/show_bug.cgi?id=175944
3308         <rdar://problem/32864306>
3309
3310         Reviewed by Jon Lee.
3311
3312         Our buildbots now all have this symbol.
3313
3314         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3315         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
3316
3317 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
3318
3319         ASSERTION FAILED: !m_valueOrException under FontFaceSet::completedLoading loading a Serious Eats page
3320         https://bugs.webkit.org/show_bug.cgi?id=175899
3321
3322         Reviewed by Tim Horton.
3323
3324         Slight style update to r221835. Also adds a test.
3325
3326         Test: fast/text/document-fonts-while-loading-crash.html
3327
3328         * css/CSSFontFaceSet.h:
3329         * css/FontFaceSet.cpp:
3330         (WebCore::FontFaceSet::FontFaceSet):
3331
3332 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
3333
3334         Inline ParserUtilities.h
3335         https://bugs.webkit.org/show_bug.cgi?id=176572
3336
3337         Reviewed by Darin Adler.
3338
3339         Its contents are only ever used from SVG files which also include SVGParserUtilities.h.
3340
3341         No new tests because there is no behavior change.
3342
3343         * WebCore.xcodeproj/project.pbxproj:
3344         * platform/text/ParserUtilities.h: Removed.
3345         * svg/SVGParserUtilities.h:
3346         (WebCore::skipString):
3347
3348 2017-09-12  Ryosuke Niwa  <rniwa@webkit.org>
3349
3350         Dragging & dropping a file creates an attachment element even when it's disabled
3351         https://bugs.webkit.org/show_bug.cgi?id=176769
3352
3353         Reviewed by Tim Horton.
3354
3355         The bug that dropping a file always created an attachment element even when it's disabled by settings
3356         was caused by WebContentReader::readFilenames always creating an attachment element. Fixed this by
3357         checking the runtime flag. The fix is tested by drag-files-to-editable-element-as-URLs.html
3358
3359         To fix the bug that HTMLAttachmentElement is always exposed on the global object even when it's disabled
3360         by settings, replaced the setting to enable attachment element by an equivalent runtime enabled flag,
3361         and hid both the interface as well as the element behind it. Fixed various bugs in our code generator
3362         to make this work.
3363
3364         Tests: editing/pasteboard/drag-files-to-editable-element-as-URLs.html
3365                editing/pasteboard/drag-files-to-editable-element-as-attachment.html
3366
3367         * bindings/js/WebCoreBuiltinNames.h: Added symbols used in the generated code.
3368         * dom/make_event_factory.pl:
3369         (defaultItemFactory): Replaced "runtimeConditonal" option by "runtimeEnabled".
3370         (generateImplementation):
3371         * dom/make_names.pl:
3372         (defaultTagPropertyHash):
3373         (printConstructorInterior): Return a HTMLUnknownElement if the element is disabled by a runtime flag.
3374         (printTypeHelpers): Make is<HTMLAttachmentElement>(~) returns false when the feature is disabled by
3375         checking whether the given element is an instance of HTMLUnknownElement.
3376         (printWrapperFunctions): Simplified this code by matching the code for settingsConditional.
3377         * editing/mac/EditorMac.mm:
3378         (WebCore::Editor::WebContentReader::readFilenames): Fixed the bug that this code was always creating
3379         an attachment element even when the feature is disabled.
3380         * html/HTMLAttachmentElement.idl: Hide this behind a runtime flag.
3381         * html/HTMLTagNames.in: 
3382         * page/RuntimeEnabledFeatures.h:
3383         (WebCore::RuntimeEnabledFeatures::setAttachmentElementEnabled): Added.
3384         (WebCore::RuntimeEnabledFeatures::attachmentElementEnabled const): Added.
3385         * page/Settings.in: Removed attachmentElementEnabled.
3386
3387 2017-09-12  Youenn Fablet  <youenn@apple.com>
3388
3389         Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
3390         https://bugs.webkit.org/show_bug.cgi?id=176579
3391
3392         Reviewed by Alex Christensen.
3393
3394         No change of behavior.
3395
3396         Introducing another version of queryCacheMatch used for the NetworkProcess implementation of the Cache.
3397         Exporting the copy of a response body to be used also there.
3398
3399         * Modules/cache/DOMCacheEngine.cpp:
3400         (WebCore::DOMCacheEngine::matchURLs):
3401         (WebCore::DOMCacheEngine::queryCacheMatch):
3402         (WebCore::DOMCacheEngine::copyResponseBody):
3403         * Modules/cache/DOMCacheEngine.h:
3404
3405 2017-09-12  Antti Koivisto  <antti@apple.com>
3406
3407         AnimationBase should point to Element instead of RenderElement
3408         https://bugs.webkit.org/show_bug.cgi?id=176807
3409
3410         Reviewed by Andreas Kling.
3411
3412         This is a step towards making animation system operate on elements and styles instead renderers.
3413
3414         No functional changes.
3415