[Attachment Support] Create attachment elements when dropping files on iOS
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2
3         [Attachment Support] Create attachment elements when dropping files on iOS
4         https://bugs.webkit.org/show_bug.cgi?id=181192
5         <rdar://problem/36280945>
6
7         Reviewed by Tim Horton.
8
9         Implements support for dropping data as attachment elements on iOS. See comments below for more detail.
10
11         Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
12                 WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
13                 WKAttachmentTests.InsertDroppedItemProvidersInOrder
14
15         * WebCore.xcodeproj/project.pbxproj:
16         * editing/WebContentReader.cpp:
17         (WebCore::WebContentReader::ensureFragment):
18
19         Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.
20
21         * editing/WebContentReader.h:
22         * editing/cocoa/WebContentReaderCocoa.mm:
23         (WebCore::WebContentReader::readFilePaths):
24
25         Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
26         the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
27         implementation on iOS.
28
29         There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
30         editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
31         to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was
32         introduced in r67403.
33
34         * editing/ios/WebContentReaderIOS.mm:
35         (WebCore::WebContentReader::readFilenames): Deleted.
36         * editing/mac/WebContentReaderMac.mm:
37         (WebCore::WebContentReader::readFilenames): Deleted.
38         * page/mac/DragControllerMac.mm:
39         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):
40
41         Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when
42         attachment elements are enabled. This allows us to load content from item providers that we otherwise would not
43         have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have
44         a default representation using standard web content.
45
46         * platform/Pasteboard.h:
47         * platform/PasteboardItemInfo.h: Added.
48         (WebCore::PasteboardItemInfo::encode const):
49         (WebCore::PasteboardItemInfo::decode):
50
51         Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding
52         support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item,
53         and flags indicating whether the item prefers attachment or inline presentation.
54
55         * platform/PasteboardStrategy.h:
56
57         Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file
58         paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which
59         includes information about the file path as well as some other metadata we'll need when deciding how to read
60         pasteboard contents as a document fragment.
61
62         * platform/PlatformPasteboard.h:
63         * platform/cocoa/PasteboardCocoa.mm:
64         (WebCore::Pasteboard::read):
65         * platform/ios/AbstractPasteboard.h:
66         * platform/ios/PasteboardIOS.mm:
67         (WebCore::Pasteboard::read):
68         (WebCore::Pasteboard::readRespectingUTIFidelities):
69
70         Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in
71         which we would want to insert an attachment element:
72         (1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to
73             handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal
74             with the case where we drop text or HTML files from the Files app, so that we don't try and insert the
75             contents of the text or HTML as inline web content.
76         (2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would
77             otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is
78             relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set.
79         We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we
80         proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop
81         handling, we don't still have a way to represent the dropped content, enter case (2).
82
83         (WebCore::Pasteboard::readFilePaths):
84         (WebCore::Pasteboard::readFilenames): Deleted.
85
86         Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex.
87
88         * platform/ios/PlatformPasteboardIOS.mm:
89         (WebCore::pasteboardItemPresentationStyle):
90         (WebCore::PlatformPasteboard::informationForItemAtIndex):
91         (WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted.
92
93         Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard
94         (i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single
95         file, so we don't end up creating multiple attachment elements for each representation of a single item
96         provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail.
97
98         * platform/ios/WebItemProviderPasteboard.h:
99         * platform/ios/WebItemProviderPasteboard.mm:
100         (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
101         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
102
103         Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle.
104
105         (-[WebItemProviderLoadResult description]):
106
107         Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an
108         item provider on drop.
109
110         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):
111
112         Return the highest fidelity loaded type identifier for a given item.
113
114         (-[WebItemProviderPasteboard allDroppedFileURLs]):
115         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
116
117         Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content
118         using attachment elements as a fallback representation, if the source writes attributed strings to the
119         pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only
120         com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to
121         markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as
122         regular web content isn't overridden when attachment elements are enabled.
123
124         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
125         (-[WebItemProviderPasteboard droppedFileURLs]): Deleted.
126         * platform/mac/DragDataMac.mm:
127         (WebCore::DragData::containsCompatibleContent const):
128
129         DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we
130         can drop as attachment elements.
131
132         * platform/mac/PasteboardMac.mm:
133         (WebCore::Pasteboard::read):
134         (WebCore::Pasteboard::readFilePaths):
135         (WebCore::Pasteboard::readFilenames): Deleted.
136
137 2018-01-03  Ting-Wei Lan  <lantw44@gmail.com>
138
139         Replace hard-coded paths in shebangs with #!/usr/bin/env
140         https://bugs.webkit.org/show_bug.cgi?id=181040
141
142         Reviewed by Alex Christensen.
143
144         * bindings/scripts/InFilesCompiler.pm:
145         * bindings/scripts/InFilesParser.pm:
146         * bindings/scripts/generate-bindings-all.pl:
147         * bindings/scripts/generate-bindings.pl:
148         * bindings/scripts/preprocess-idls.pl:
149         * css/make-css-file-arrays.pl:
150         * css/makeprop.pl:
151         * css/makevalues.pl:
152         * dom/make_event_factory.pl:
153         * dom/make_names.pl:
154         * extract-localizable-strings.pl:
155         * make-hash-tools.pl:
156
157 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
158
159         [Attachment Support] Add plumbing for starting a drag with promised blob data
160         https://bugs.webkit.org/show_bug.cgi?id=181201
161
162         Reviewed by Tim Horton.
163
164         Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI
165         process. See comments below for more detail.
166
167         The only change in behavior is that dragging an attachment element will no longer write web content and injected
168         bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one
169         existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS,
170         attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to
171         current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this
172         doesn't make a difference to macOS Mail either.
173
174         * editing/Editor.h:
175         * editing/cocoa/EditorCocoa.mm:
176         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
177
178         Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the
179         same document. Also gives the injected editor bundle a chance to supply custom pasteboard types.
180
181         * loader/EmptyClients.cpp:
182         * page/DragClient.h:
183         (WebCore::DragClient::prepareToDragPromisedBlob):
184
185         Add new DragClient methods to send information about a promised blob to the UI process.
186
187         * page/DragController.cpp:
188         (WebCore::DragController::startDrag):
189
190         Call dragAttachmentElement when starting a drag on an attachment element.
191
192         (WebCore::DragController::dragAttachmentElement):
193
194         Try to begin dragging a given attachment element, propagating promised blob information to the client layers.
195         Returns true iff the attachment is backed by blob data (i.e. the file is nonnull).
196
197         * platform/PromisedBlobInfo.h:
198
199         Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would
200         allow injected bundle data and other private types alongside the main attachment data on the pasteboard.
201
202 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
203
204         Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
205         https://bugs.webkit.org/show_bug.cgi?id=181268
206
207         Reviewed by Alex Christensen.
208
209         These functions were always called with resolutionScale=1.
210
211         * platform/graphics/cg/ImageBufferCG.cpp:
212         (WebCore::ImageBuffer::getUnmultipliedImageData const):
213         (WebCore::ImageBuffer::getPremultipliedImageData const):
214         (WebCore::ImageBuffer::putByteArray):
215         * platform/graphics/cg/ImageBufferDataCG.cpp:
216         (WebCore::ImageBufferData::getData const):
217         (WebCore::ImageBufferData::putData):
218         (WebCore::affineWarpBufferData): Deleted.
219         * platform/graphics/cg/ImageBufferDataCG.h:
220
221 2018-01-03  John Wilander  <wilander@apple.com>
222
223         Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process
224         https://bugs.webkit.org/show_bug.cgi?id=181270
225         <rdar://problem/36289544>
226
227         Reviewed by Alex Christensen.
228
229         No new tests. Existing test re-enabled.
230
231         This change refactors how the web process tells the network process
232         to remove storage access. Previously, this was done over the UI process
233         just like requests for storage access. But since no further reasoning
234         is needed, the message should go straight from the web process to the
235         network process for performance reasons and to minimize the risk of a
236         race.
237
238         As a consequence, the XPC code for storage access removal in the UI
239         process is deleted.
240
241         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
242         (WebCore::NetworkStorageSession::cookieStoragePartition const):
243             Removes the storageAccessAPIEnabled check since the flag
244             doesn't get propagated when the network process is created.
245             Figuring this out will take some work which is unnecessary
246             when we already gate access to the feature in Document.idl.
247
248 2018-01-03  James Craig  <jcraig@apple.com>
249
250         AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet
251         https://bugs.webkit.org/show_bug.cgi?id=168447
252         <rdar://problem/30559874>
253
254         Reviewed by Simon Fraser.
255
256         Double-invert video when platform 'invert colors' setting is enabled. Behavior matches 
257         current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps.
258
259         Tests: accessibility/smart-invert-reference.html
260                accessibility/smart-invert.html
261
262         * Modules/modern-media-controls/controls/media-controls.css:
263         (@media (inverted-colors)):
264         (:host):
265         (picture):
266         * css/html.css:
267         (@media (inverted-colors)):
268         (video):
269
270 2018-01-03  Youenn Fablet  <youenn@apple.com>
271
272         LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired
273         https://bugs.webkit.org/show_bug.cgi?id=181264
274
275         Reviewed by Eric Carlson.
276
277         Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds.
278         Calling suspendIfNeeded in create method instead of constructor.
279
280         * Modules/mediastream/UserMediaRequest.cpp:
281         (WebCore::UserMediaRequest::create):
282         (WebCore::UserMediaRequest::UserMediaRequest):
283
284 2018-01-03  Antti Koivisto  <antti@apple.com>
285
286         Remove DeprecatedCSSOMValue::equals
287         https://bugs.webkit.org/show_bug.cgi?id=181241
288
289         Reviewed by Zalan Bujtas.
290
291         This is dead code.
292
293         * css/DeprecatedCSSOMValue.cpp:
294         (WebCore::compareCSSOMValues): Deleted.
295         (WebCore::DeprecatedCSSOMValue::equals const): Deleted.
296         * css/DeprecatedCSSOMValue.h:
297         (WebCore::DeprecatedCSSOMValue::operator== const): Deleted.
298         (WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted.
299         * css/DeprecatedCSSOMValueList.cpp:
300         (WebCore::DeprecatedCSSOMValueList::equals const): Deleted.
301         * css/DeprecatedCSSOMValueList.h:
302
303 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
304
305         feLighting is broken with primitiveUnits="objectBoundingBox"
306         https://bugs.webkit.org/show_bug.cgi?id=181197
307
308         Reviewed by Tim Horton.
309
310         With <filter primitiveUnits="objectBoundingBox"> we need to convert the coordinates
311         of fePointLights and feSpotLights into user space coordinates. Following
312         https://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute
313         this is done by treating them as fractions of the bounding box on the referencing
314         element, with treatment for z following https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
315         
316         To do this, store the bounds of the referencing elemenet on SVGFilterBuilder as
317         targetBoundingBox, and store the primitiveUnits type. Then do the conversion of lighting
318         coordinates in SVGFESpecularLightingElement::build() and SVGFEDiffuseLightingElement::build().
319
320         Remove SVGFELightElement::findLightSource(), since we need to be able to pass the SVGFilterBuilder
321         to the lightSource() function so hoist the code up.
322
323         Tests: svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
324                svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
325                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox-expected.svg
326                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox.svg
327                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
328                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
329
330         * rendering/svg/RenderSVGResourceFilter.cpp:
331         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
332         * svg/SVGFEDiffuseLightingElement.cpp:
333         (WebCore::SVGFEDiffuseLightingElement::build):
334         * svg/SVGFEDistantLightElement.cpp:
335         (WebCore::SVGFEDistantLightElement::lightSource const):
336         * svg/SVGFEDistantLightElement.h:
337         * svg/SVGFELightElement.cpp:
338         (WebCore::SVGFELightElement::findLightSource): Deleted.
339         * svg/SVGFELightElement.h:
340         * svg/SVGFEPointLightElement.cpp:
341         (WebCore::SVGFEPointLightElement::lightSource const):
342         * svg/SVGFEPointLightElement.h:
343         * svg/SVGFESpecularLightingElement.cpp:
344         (WebCore::SVGFESpecularLightingElement::build):
345         * svg/SVGFESpotLightElement.cpp:
346         (WebCore::SVGFESpotLightElement::lightSource const):
347         * svg/SVGFESpotLightElement.h:
348         * svg/graphics/filters/SVGFilterBuilder.h:
349         (WebCore::SVGFilterBuilder::setTargetBoundingBox):
350         (WebCore::SVGFilterBuilder::targetBoundingBox const):
351         (WebCore::SVGFilterBuilder::primitiveUnits const):
352         (WebCore::SVGFilterBuilder::setPrimitiveUnits):
353
354 2018-01-03  Antti Koivisto  <antti@apple.com>
355
356         Crash beneath CSSValue::equals @ csas.cz
357         https://bugs.webkit.org/show_bug.cgi?id=181243
358         <rdar://problem/35990826>
359
360         Reviewed by Alex Christensen.
361
362         Test: fast/text/oblique-degree-equals-crash.html
363
364         * css/CSSFontStyleValue.cpp:
365         (WebCore::CSSFontStyleValue::equals const):
366
367         Null check both oblique pointers.
368
369 2018-01-03  Joseph Pecoraro  <pecoraro@apple.com>
370
371         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
372         https://bugs.webkit.org/show_bug.cgi?id=180979
373         <rdar://problem/36146670>
374
375         Reviewed by Matt Baker.
376
377         * platform/graphics/cocoa/FontCacheCoreText.cpp:
378         (fontNameIsSystemFont):
379         (WebCore::FontCache::systemFontFamilies):
380         Switch to the original Mac algorithm before r180979 that uses
381         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
382         available on iOS but now it is. This is a performance improvement on
383         both platforms, but significantly so on macOS. It also finds more,
384         valid, family names.
385
386 2018-01-03  Michael Catanzaro  <mcatanzaro@igalia.com>
387
388         ASSERTION FAILED: !source || is<Target>(*source) in CoordinatedGraphicsLayer::removeFromParent
389         https://bugs.webkit.org/show_bug.cgi?id=166568
390
391         Reviewed by Simon Fraser.
392
393         When a GraphicsLayer has a mask layer, it fails to properly unparent the mask layer before
394         it is destroyed. This leaves the mask layer with a dangling parent pointer. Fix it, while
395         taking care not to introduce yet another virtual function call during the execution of the
396         destructor.
397
398         * platform/graphics/GraphicsLayer.cpp:
399         (WebCore::GraphicsLayer::willBeDestroyed):
400
401 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
402
403         SVG lighting filter lights are in the wrong coordinate system
404         https://bugs.webkit.org/show_bug.cgi?id=181147
405
406         Reviewed by Zalan Bujtas.
407
408         Point and spot light coordinates weren't being converted into buffer-relative
409         coordinates before being fed into the lighting math, resulting in incorrect light
410         rendering on Retina devices, and when the filter primitive region was clipped.
411
412         Fix by storing absoluteUnclippedSubregion on FilterEffect, which allows us to map
413         lighting points from user space coordinates into the coordinates of the buffer being
414         used for rendering. Also scale the light z coordinate by doing a dummy point mapping in x.
415
416         Rename members of PointLightSource and SpotLightSource to make it clear which coordinate
417         system they are in.
418
419         Tests include HiDPI tests.
420
421         Tests: svg/filters/fePointLight-coordinates-expected.svg
422                svg/filters/fePointLight-coordinates.svg
423                svg/filters/feSpotLight-coordinates-expected.svg
424                svg/filters/feSpotLight-coordinates.svg
425                svg/filters/hidpi/fePointLight-coordinates-expected.svg
426                svg/filters/hidpi/fePointLight-coordinates.svg
427                svg/filters/hidpi/feSpotLight-coordinates-expected.svg
428                svg/filters/hidpi/feSpotLight-coordinates.svg
429
430         * platform/graphics/FloatPoint3D.h: Make it easy to get and set the X and Y coords as a FloatPoint.
431         (WebCore::FloatPoint3D::xy const):
432         (WebCore::FloatPoint3D::setXY):
433         * platform/graphics/GeometryUtilities.cpp:
434         (WebCore::mapPoint):
435         (WebCore::mapRect):
436         * platform/graphics/GeometryUtilities.h: Helper to make a point between rects.
437         * platform/graphics/filters/DistantLightSource.cpp:
438         (WebCore::DistantLightSource::initPaintingData):
439         * platform/graphics/filters/DistantLightSource.h:
440         * platform/graphics/filters/FELighting.cpp:
441         (WebCore::FELighting::drawLighting):
442         * platform/graphics/filters/FilterEffect.cpp:
443         (WebCore::FilterEffect::mapPointFromUserSpaceToBuffer const):
444         * platform/graphics/filters/FilterEffect.h:
445         (WebCore::FilterEffect::setUnclippedAbsoluteSubregion):
446         * platform/graphics/filters/LightSource.h:
447         * platform/graphics/filters/PointLightSource.cpp:
448         (WebCore::PointLightSource::initPaintingData):
449         (WebCore::PointLightSource::computePixelLightingData const):
450         (WebCore::PointLightSource::setX):
451         (WebCore::PointLightSource::setY):
452         (WebCore::PointLightSource::setZ):
453         * platform/graphics/filters/PointLightSource.h:
454         (WebCore::PointLightSource::position const):
455         (WebCore::PointLightSource::PointLightSource):
456         * platform/graphics/filters/SpotLightSource.cpp:
457         (WebCore::SpotLightSource::initPaintingData):
458         (WebCore::SpotLightSource::computePixelLightingData const):
459         (WebCore::SpotLightSource::setX):
460         (WebCore::SpotLightSource::setY):
461         (WebCore::SpotLightSource::setZ):
462         (WebCore::SpotLightSource::setPointsAtX):
463         (WebCore::SpotLightSource::setPointsAtY):
464         (WebCore::SpotLightSource::setPointsAtZ):
465         * platform/graphics/filters/SpotLightSource.h:
466         (WebCore::SpotLightSource::position const):
467         (WebCore::SpotLightSource::direction const):
468         (WebCore::SpotLightSource::SpotLightSource):
469         * rendering/svg/RenderSVGResourceFilter.cpp:
470         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
471         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
472         (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion):
473
474 2018-01-03  Youenn Fablet  <youenn@apple.com>
475
476         Select service worker for documents with data/blob URLS
477         https://bugs.webkit.org/show_bug.cgi?id=181213
478
479         Reviewed by Alex Christensen.
480
481         Covered by updated test.
482
483         Reusing the service worker of the parent for blob/data URL documents.
484
485         * loader/DocumentLoader.cpp:
486         (WebCore::isLocalURL):
487         (WebCore::DocumentLoader::commitData):
488
489 2018-01-03  Ryan Haddad  <ryanhaddad@apple.com>
490
491         Unreviewed, rolling out r226352.
492
493         Breaks Sierra and El Capitan builds.
494
495         Reverted changeset:
496
497         "Web Inspector: Slow open time enumerating system fonts
498         (FontCache::systemFontFamilies)"
499         https://bugs.webkit.org/show_bug.cgi?id=180979
500         https://trac.webkit.org/changeset/226352
501
502 2018-01-03  Philippe Normand  <pnormand@igalia.com>
503
504         [GStreamer] The bus synchronous handler should be in the base player class
505         https://bugs.webkit.org/show_bug.cgi?id=181237
506
507         Reviewed by Carlos Garcia Campos.
508
509         Because this is where video rendering is handled.
510
511         No new tests, this is only a refactoring.
512
513         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
514         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
515         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
516         (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):
517
518 2018-01-03  Philippe Normand  <pnormand@igalia.com>
519
520         [GStreamer] move MediaSample implementation out of mse/
521         https://bugs.webkit.org/show_bug.cgi?id=179165
522
523         Reviewed by Carlos Garcia Campos.
524
525         This module isn't specific to MSE and can potentially be reused
526         elsewhere, for WebRTC for instance. Additionally the
527         ::platformSample() method was implemented and the code was cleaned up.
528
529         * platform/GStreamer.cmake:
530         * platform/MediaSample.h:
531         * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
532         (WebCore::GStreamerMediaSample::platformSample):
533         * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
534         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
535         (WebCore::PlaybackPipeline::enqueueSample):
536
537 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
538
539         Unreviewed. Fix resource load stats tests on GLib based ports after r226355.
540
541         The monitor can be created in the work queue thread too.
542
543         * platform/glib/FileMonitorGLib.cpp:
544         (WebCore::FileMonitor::FileMonitor):
545
546 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
547
548         [GTK] Crash destroying WebCore::FileMonitor
549         https://bugs.webkit.org/show_bug.cgi?id=181138
550
551         Reviewed by Michael Catanzaro.
552
553         Ensure that platform file monitor is always created and destroyed in the work queue thread synchronously.
554
555         * platform/FileMonitor.h:
556         * platform/glib/FileMonitorGLib.cpp:
557         (WebCore::FileMonitor::FileMonitor):
558         (WebCore::FileMonitor::~FileMonitor):
559         (WebCore::FileMonitor::didChange):
560
561 2018-01-02  Joseph Pecoraro  <pecoraro@apple.com>
562
563         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
564         https://bugs.webkit.org/show_bug.cgi?id=180979
565         <rdar://problem/36146670>
566
567         Reviewed by Matt Baker.
568
569         * platform/graphics/cocoa/FontCacheCoreText.cpp:
570         (WebCore::FontCache::systemFontFamilies):
571         Switch to the original Mac algorithm before r180979 that uses
572         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
573         available on iOS but now it is. This is a performance improvement on
574         both platforms, but significantly so on macOS. It also finds more,
575         valid, family names.
576
577 2018-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
578
579         Unreviewed, fix GCC warning by using #include
580         https://bugs.webkit.org/show_bug.cgi?id=181189
581
582         This file is included in C++ files. Use #include instead of #import to suppress warning in GCC.
583
584         * platform/PromisedBlobInfo.h:
585
586 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
587
588         Remove std::chrono completely
589         https://bugs.webkit.org/show_bug.cgi?id=181186
590
591         Reviewed by Alex Christensen.
592
593         Use MonotonicTime, WallTime, and Seconds instead.
594         Changes are mechanical ones. But persistent network cache data is changed.
595         So we bump the version number of the cache storage.
596
597         * Modules/indexeddb/server/IDBServer.cpp:
598         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
599         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
600         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
601         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
602         * Modules/indexeddb/server/IDBServer.h:
603         * Modules/webdatabase/DatabaseTracker.cpp:
604         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
605         * Modules/webdatabase/DatabaseTracker.h:
606         * dom/Document.cpp:
607         (WebCore::Document::lastModified):
608         * html/HTMLMediaElement.cpp:
609         (WebCore::HTMLMediaElement::clearMediaCache):
610         * html/HTMLMediaElement.h:
611         (WebCore::HTMLMediaElement::clearMediaCache):
612         * loader/CrossOriginPreflightResultCache.cpp:
613         (WebCore::parseAccessControlMaxAge):
614         (WebCore::CrossOriginPreflightResultCacheItem::parse):
615         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
616         * loader/CrossOriginPreflightResultCache.h:
617         * loader/cache/CachedResource.cpp:
618         (WebCore::CachedResource::CachedResource):
619         (WebCore::CachedResource::freshnessLifetime const):
620         (WebCore::CachedResource::responseReceived):
621         (WebCore::CachedResource::updateResponseAfterRevalidation):
622         * loader/cache/CachedResource.h:
623         * platform/FileSystem.cpp:
624         (WebCore::FileSystem::getFileModificationTime):
625         * platform/FileSystem.h:
626         * platform/SearchPopupMenu.h:
627         * platform/cocoa/SearchPopupMenuCocoa.h:
628         * platform/cocoa/SearchPopupMenuCocoa.mm:
629         (WebCore::toSystemClockTime):
630         (WebCore::toNSDateFromSystemClock):
631         (WebCore::removeRecentlyModifiedRecentSearches):
632         * platform/graphics/MediaPlayer.cpp:
633         (WebCore::MediaPlayer::clearMediaCache):
634         * platform/graphics/MediaPlayer.h:
635         * platform/graphics/MediaPlayerPrivate.h:
636         (WebCore::MediaPlayerPrivateInterface::clearMediaCache):
637         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
638         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
639         (WebCore::toSystemClockTime):
640         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
641         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
642         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
643         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
644         * platform/network/CacheValidation.cpp:
645         (WebCore::computeCurrentAge):
646         (WebCore::computeFreshnessLifetimeForHTTPFamily):
647         (WebCore::updateRedirectChainStatus):
648         (WebCore::redirectChainAllowsReuse):
649         (WebCore::parseCacheControlDirectives):
650         * platform/network/CacheValidation.h:
651         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
652         * platform/network/HTTPParsers.cpp:
653         (WebCore::parseHTTPDate):
654         * platform/network/HTTPParsers.h:
655         * platform/network/PlatformCookieJar.h:
656         * platform/network/ResourceResponseBase.cpp:
657         (WebCore::ResourceResponseBase::cacheControlMaxAge const):
658         (WebCore::parseDateValueInHeader):
659         (WebCore::ResourceResponseBase::date const):
660         (WebCore::ResourceResponseBase::age const):
661         (WebCore::ResourceResponseBase::expires const):
662         (WebCore::ResourceResponseBase::lastModified const):
663         * platform/network/ResourceResponseBase.h:
664         * platform/network/cf/CookieJarCFNet.cpp:
665         (WebCore::deleteAllCookiesModifiedSince):
666         * platform/network/curl/CookieJarCurl.cpp:
667         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
668         (WebCore::deleteAllCookiesModifiedSince):
669         * platform/network/curl/CookieJarCurl.h:
670         * platform/network/curl/CurlCacheEntry.cpp:
671         (WebCore::CurlCacheEntry::CurlCacheEntry):
672         (WebCore::CurlCacheEntry::isCached):
673         (WebCore::CurlCacheEntry::parseResponseHeaders):
674         * platform/network/curl/CurlCacheEntry.h:
675         * platform/network/mac/CookieJarMac.mm:
676         (WebCore::deleteAllCookiesModifiedSince):
677         * platform/network/soup/CookieJarSoup.cpp:
678         (WebCore::deleteAllCookiesModifiedSince):
679         * platform/win/SearchPopupMenuWin.cpp:
680         (WebCore::SearchPopupMenuWin::loadRecentSearches):
681         * rendering/RenderSearchField.cpp:
682         (WebCore::RenderSearchField::addSearchResult):
683
684 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
685
686         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
687         https://bugs.webkit.org/show_bug.cgi?id=181189
688
689         Reviewed by Tim Horton.
690
691         Introduces a new header containing structs to be used for writing blob data when dragging. PromisedBlobInfo
692         represents information needed to declare data on the pasteboard that will eventually be provided via a Blob.
693         This includes the type and filename of the Blob-backed content. PromisedBlobData represents information needed
694         to actually deliver the Blob's content to the platform, and is sent some time after its corresponding
695         PromisedBlobInfo. The content may either be in the form of a file path (as is the case using the previous
696         declareAndWriteAttachment codepath) or a data buffer (which we would use if the Blob is not already backed by a
697         file on disk).
698
699         No new tests, since there is no observable change in functionality yet.
700
701         * WebCore.xcodeproj/project.pbxproj:
702         * platform/PromisedBlobInfo.h: Added.
703         (WebCore::PromisedBlobInfo::operator bool const):
704         (WebCore::PromisedBlobData::hasData const):
705         (WebCore::PromisedBlobData::hasFile const):
706         (WebCore::PromisedBlobData::operator bool const):
707         (WebCore::PromisedBlobData::fulfills const):
708
709 2018-01-02  Brady Eidson  <beidson@apple.com>
710
711         Make MessagePortChannel::takeAllMessagesFromRemote asynchronous.
712         https://bugs.webkit.org/show_bug.cgi?id=181205
713
714         Reviewed by Alex Christensen.
715
716         No new tests (No behavior change)
717
718         This is needed for the ongoing WK2 MessagePort work.
719
720         For WK1 in-process MessagePorts it is still synchronous; no behavior change.
721
722         * dom/InProcessMessagePortChannel.cpp:
723         (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote):
724         * dom/InProcessMessagePortChannel.h:
725
726         * dom/MessagePort.cpp:
727         (WebCore::MessagePort::dispatchMessages):
728         * dom/MessagePortChannel.h:
729
730 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
731
732         Add a WebAuthentication runtime feature flag
733         https://bugs.webkit.org/show_bug.cgi?id=181220
734         <rdar://problem/36055305>
735
736         Reviewed by Brent Fulgham.
737
738         This patch basically renames the CredentialManagement runtime feature flag into
739         WebAuthentication runtime feature flag.
740
741         No tests.
742
743         * Modules/credentialmanagement/BasicCredential.idl:
744         * Modules/credentialmanagement/CredentialsContainer.idl:
745         * Modules/credentialmanagement/NavigatorCredentials.idl:
746         * Modules/webauthn/PublicKeyCredential.idl:
747         * page/RuntimeEnabledFeatures.h:
748         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationEnabled):
749         (WebCore::RuntimeEnabledFeatures::webAuthenticationEnabled const):
750         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Deleted.
751         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled const): Deleted.
752
753 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
754
755         [Attachment Support] Don't Blob-convert images and attachments with https:, http: or data: urls
756         https://bugs.webkit.org/show_bug.cgi?id=181143
757         <rdar://problem/36200381>
758
759         Reviewed by Tim Horton.
760
761         Clients such as Mail would expect pasting or dropping an image with src="https://..." to result in the source
762         URL being preserved (i.e. staying as remote images) instead of creating image attachments out of them. This
763         patch hooks into the shouldConvertToBlob() check added in r226272 so that it applies to attachment element
764         replacement as well.
765
766         Test: WKAttachmentTests.DoNotInsertDataURLImagesAsAttachments
767
768         * editing/cocoa/WebContentReaderCocoa.mm:
769         (WebCore::shouldConvertToBlob):
770         (WebCore::replaceRichContentWithAttachments):
771
772 2018-01-02  Brady Eidson  <beidson@apple.com>
773
774         Identify MessagePorts by a globally unique MessagePortIdentifier.
775         https://bugs.webkit.org/show_bug.cgi?id=181172
776
777         Reviewed by Alex Christensen.
778
779         No new tests (Behavior change covered by all existing tests).
780
781         This cleans up the abstract MessagePortChannel interface to be in terms of identifiers
782         instead of actual MessagePort objects.
783         
784         The identifiers are compounded with the current ProcessIdentifier meaning they are global
785         across all processes for the running UI process, enabling easy cross-process communication.
786         
787         (Actual cross-process communication comes in a followup)
788         
789         * WebCore.xcodeproj/project.pbxproj:
790         
791         * dom/InProcessMessagePortChannel.cpp:
792         (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts):
793         (WebCore::InProcessMessagePortChannel::isConnectedTo):
794         (WebCore::InProcessMessagePortChannel::entangleWithRemoteIfOpen):
795         (WebCore::InProcessMessagePortChannel::entangleIfOpen): Deleted.
796         * dom/InProcessMessagePortChannel.h:
797         
798         * dom/MessageChannel.cpp:
799         (WebCore::MessageChannel::MessageChannel):
800         (WebCore::m_port2):
801         
802         * dom/MessagePort.cpp:
803         (WebCore::allMessagePortsLock):
804         (WebCore::MessagePort::ref const):
805         (WebCore::MessagePort::deref const):
806         (WebCore::MessagePort::existingMessagePortForIdentifier):
807         (WebCore::MessagePort::MessagePort):
808         (WebCore::MessagePort::~MessagePort):
809         (WebCore::MessagePort::postMessage):
810         (WebCore::MessagePort::entangleWithRemote):
811         (WebCore::MessagePort::entanglePorts):
812         (WebCore::MessagePort::entangle): Deleted.
813         * dom/MessagePort.h:
814         
815         * dom/MessagePortChannel.h:
816         
817         * dom/MessagePortIdentifier.h: Added.
818         (WebCore::operator==):
819         (WebCore::MessagePortIdentifier::encode const):
820         (WebCore::MessagePortIdentifier::decode):
821         (WebCore::MessagePortIdentifier::hash const):
822         (WTF::MessagePortIdentifierHash::hash):
823         (WTF::MessagePortIdentifierHash::equal):
824         (WTF::HashTraits<WebCore::MessagePortIdentifier>::emptyValue):
825         (WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue):
826         (WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue):
827
828 2018-01-02  Youenn Fablet  <youenn@apple.com>
829
830         Memory cache should not reuse resources with different credential fetch option
831         https://bugs.webkit.org/show_bug.cgi?id=181212
832
833         Reviewed by Alex Christensen.
834
835         Covered by rebased test.
836
837         * loader/cache/CachedResourceLoader.cpp:
838         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
839
840 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
841
842         Update Credential Management API for WebAuthentication
843         https://bugs.webkit.org/show_bug.cgi?id=181082
844         <rdar://problem/36055239>
845
846         Reviewed by Brent Fulgham.
847
848         Part 2/2
849
850         This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core.
851         which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it
852         introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which
853         cannot be instantiated.
854
855         Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html
856                http/wpt/credential-management/credentialscontainer-get-basics.https.html
857                http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html
858                http/wpt/credential-management/idl.https.html
859
860         * CMakeLists.txt:
861         * DerivedSources.make:
862         * Modules/credentialmanagement/BasicCredential.cpp:
863         (WebCore::BasicCredential::BasicCredential):
864         (WebCore::BasicCredential::type const):
865         * Modules/credentialmanagement/BasicCredential.h:
866         (WebCore::BasicCredential::discovery const):
867         * Modules/credentialmanagement/BasicCredential.idl:
868         * Modules/credentialmanagement/CredentialCreationOptions.h:
869         * Modules/credentialmanagement/CredentialCreationOptions.idl:
870         * Modules/credentialmanagement/CredentialRequestOptions.h:
871         * Modules/credentialmanagement/CredentialRequestOptions.idl:
872         * Modules/credentialmanagement/CredentialsContainer.cpp:
873         (WebCore::CredentialsContainer::CredentialsContainer):
874         (WebCore::CredentialsContainer::isSameOriginWithItsAncestors):
875         (WebCore::CredentialsContainer::dispatchTask):
876         (WebCore::CredentialsContainer::get):
877         (WebCore::CredentialsContainer::store):
878         (WebCore::CredentialsContainer::isCreate):
879         (WebCore::CredentialsContainer::preventSilentAccess):
880         * Modules/credentialmanagement/CredentialsContainer.h:
881         (WebCore::CredentialsContainer::create):
882         (WebCore::CredentialsContainer::CredentialsContainer): Deleted.
883         * Modules/credentialmanagement/CredentialsContainer.idl:
884         * Modules/credentialmanagement/NavigatorCredentials.cpp:
885         (WebCore::NavigatorCredentials::credentials):
886         * Modules/credentialmanagement/NavigatorCredentials.h:
887         * Modules/credentialmanagement/NavigatorCredentials.idl:
888         * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
889         (WebCore::PublicKeyCredential::PublicKeyCredential):
890         (WebCore::PublicKeyCredential::collectFromCredentialStore):
891         (WebCore::PublicKeyCredential::discoverFromExternalSource):
892         (WebCore::PublicKeyCredential::store):
893         (WebCore::PublicKeyCredential::create):
894         * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
895         * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl.
896         * Sources.txt:
897         * WebCore.xcodeproj/project.pbxproj:
898         * bindings/js/WebCoreBuiltinNames.h:
899         * page/RuntimeEnabledFeatures.h:
900
901 2018-01-02  Oleksandr Skachkov  <gskachkov@gmail.com>
902
903         WebAssembly: sending module to iframe fails
904         https://bugs.webkit.org/show_bug.cgi?id=179263
905
906         Reviewed by JF Bastien.
907
908         Allow use WebAssembly.Module as input parameters for postMessage 
909         in window and iframe object. To prevent sending message to iframe
910         that is not ready, in iframe-* test we are waiting message from
911         iframe only after that we send message to it.   
912
913         Tests: wasm/iframe-parent-postmessage.html
914                wasm/iframe-postmessage.html
915                wasm/window-postmessage.html
916
917         * bindings/js/SerializedScriptValue.cpp:
918         (WebCore::CloneSerializer::dumpIfTerminal):
919         * bindings/js/SerializedScriptValue.h:
920         * page/DOMWindow.cpp:
921         (WebCore::DOMWindow::postMessage):
922
923 == Rolled over to ChangeLog-2018-01-01 ==