Assert that Node::insertedInto doesn't fire an event
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-10-16  Ryosuke Niwa  <rniwa@webkit.org>
2
3         Assert that Node::insertedInto doesn't fire an event
4         https://bugs.webkit.org/show_bug.cgi?id=178376
5         <rdar://problem/35022857>
6
7         Reviewed by Daniel Bates.
8
9         Fixed the assertion in notifyChildNodeInserted since this function MUST NOT dispatch an event,
10         and moved a bunch of event-dispatching code from Node::insertedInto into Node::finishedInsertingSubtree.
11
12         No new tests since the existing tests cover the behavioral change.
13
14         * dom/ContainerNodeAlgorithms.cpp:
15         (WebCore::notifyChildNodeInserted): Fixed the assertion.
16         * dom/ProcessingInstruction.cpp:
17         (WebCore::ProcessingInstruction::insertedInto):
18         (WebCore::ProcessingInstruction::finishedInsertingSubtree): Extracted from insertedInto since
19         checkStyleSheet can dispatch an event.
20         * dom/ProcessingInstruction.h:
21         * html/HTMLBodyElement.cpp:
22         (WebCore::HTMLBodyElement::insertedInto):
23         (WebCore::HTMLBodyElement::finishedInsertingSubtree): Extracted from insertedInto since
24         setIntegralAttribute could dispatch DOMAttrModified synchronously.
25         * html/HTMLBodyElement.h:
26
27 2017-10-16  Chris Dumez  <cdumez@apple.com>
28
29         ServiceWorkerRegistration should subclass RefCounted<>
30         https://bugs.webkit.org/show_bug.cgi?id=178374
31
32         Reviewed by Ryosuke Niwa.
33
34         ServiceWorkerRegistration should subclass RefCounted<> or we end up with an infinite recursion
35         when constructing such object. This is because ServiceWorkerRegistration subclasses
36         EventTargetWithInlineData which implements ref() / deref() by calling refEventTarget() /
37         derefEventTarget(). refEventTarget() / derefEventTarget() are implemented in
38         ServiceWorkerRegistration so that they call ref() / deref() (which ends up being EventTarget's
39         methods).
40
41         * workers/service/ServiceWorkerRegistration.h:
42
43 2017-10-16  Jer Noble  <jer.noble@apple.com>
44
45         ImageDecoderAVFObjC fails to create more CMSampleBuffers after creating about 32MB worth.
46         https://bugs.webkit.org/show_bug.cgi?id=178360
47
48         Reviewed by Eric Carlson.
49
50         AVSampleBufferGenerator has a constrained memory pool of about 32MB in size. Once
51         CMSampleBuffers representing about 32MB of memory are allocated, no more can be created
52         until previously created ones are released. So rather than (only) creating the sample
53         buffers up front in readSampleMetadata(), also create them dynamically, if missing, in
54         createFrameImageAtIndex(...) and release them in storeSampleBuffer(...) after they have been
55         decoded.
56
57         Drive-by fix: the expected content length was never actually set by the owner of ImageDecoderAVFObjC.
58         Now that the expected content length is available, we don't have to wait until the data is complete
59         to respond to requests.
60
61         * platform/graphics/ImageSource.cpp:
62         (WebCore::ImageSource::ensureDecoderAvailable):
63         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
64         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
65         (SOFT_LINK_POINTER_OPTIONAL):
66         (-[WebCoreSharedBufferResourceLoaderDelegate canFulfillRequest:]):
67         (-[WebCoreSharedBufferResourceLoaderDelegate fulfillRequest:]):
68         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
69         (WebCore::imageDecoderAssetOptions):
70         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack):
71         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
72         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
73         (WebCore::ImageDecoderAVFObjC::setExpectedContentSize):
74
75 2017-10-12  Matt Rajca  <mrajca@apple.com>
76
77         Add API support for quirk that lets an arbitrary click allow auto-play.
78         https://bugs.webkit.org/show_bug.cgi?id=178227
79
80         Reviewed by Alex Christensen.
81
82         Added API test.
83         
84         Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets
85         an arbitrary click allow auto-play via website policies.
86
87         * html/MediaElementSession.cpp:
88         (WebCore::needsArbitraryUserGestureAutoplayQuirk):
89         * loader/DocumentLoader.h:
90
91 2017-10-16  Chris Dumez  <cdumez@apple.com>
92
93         DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject]
94         https://bugs.webkit.org/show_bug.cgi?id=178366
95
96         Reviewed by Youenn Fablet.
97
98         DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject]. We attempted to do so using JSDOMQuad::visitAdditionalChildren()
99         but the code did not work because we failed to generate a "isReachableFromOpaqueRoots()" function for JSDOMPoint.
100
101         Test: fast/css/DOMQuad-points-SameObject.html
102
103         * dom/DOMPoint.idl:
104
105 2017-10-16  Andy Estes  <aestes@apple.com>
106
107         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
108         https://bugs.webkit.org/show_bug.cgi?id=178191
109         <rdar://problem/34906367>
110
111         Reviewed by Tim Horton.
112
113         Added test cases to http/tests/ssl/applepay/ApplePaySession.html.
114
115         * Modules/applepay/ApplePayError.idl:
116         * Modules/applepay/ApplePayPaymentContact.h:
117         * Modules/applepay/ApplePayPaymentContact.idl:
118         * Modules/applepay/ApplePaySessionPaymentRequest.h:
119         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
120         (WebCore::subLocality):
121         (WebCore::setSubLocality):
122         (WebCore::subAdministrativeArea):
123         (WebCore::setSubAdministrativeArea):
124         (WebCore::convert):
125
126 2017-10-16  Alex Christensen  <achristensen@webkit.org>
127
128         Allow modern decoding of URLs
129         https://bugs.webkit.org/show_bug.cgi?id=178265
130
131         Reviewed by Chris Dumez.
132
133         * platform/URL.h:
134         (WebCore::URL::decode):
135
136 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
137
138         Unreviewed, rolling out r223425.
139
140         This change broke internal builds.
141
142         Reverted changeset:
143
144         "Remove unnecessary include from Document.h"
145         https://bugs.webkit.org/show_bug.cgi?id=178247
146         https://trac.webkit.org/changeset/223425
147
148 2017-10-16  Maureen Daum  <mdaum@apple.com>
149
150         If an origin doesn't have databases in the Databases table we should still remove its information from disk in DatabaseTracker::deleteOrigin()
151         https://bugs.webkit.org/show_bug.cgi?id=178281
152         <rdar://problem/34576132>
153
154         Reviewed by Brent Fulgham.
155
156         New test:
157         DatabaseTracker.DeleteOriginWithMissingEntryInDatabasesTable
158
159         * Modules/webdatabase/DatabaseTracker.cpp:
160         (WebCore::DatabaseTracker::deleteOrigin):
161         If databaseNames is empty, don't bail early. Instead, delete everything in the directory
162         containing the databases for this origin. This condition indicates that we previously
163         tried to remove the origin but didn't get all of the way through the deletion process.
164         Because we have lost track of the databases for this origin, we can assume that no
165         other process is accessing them. This means it should be safe to delete them outright.
166
167 2017-10-16  Youenn Fablet  <youenn@apple.com>
168
169         [FETCH] Remove Request.type getter
170         https://bugs.webkit.org/show_bug.cgi?id=177798
171
172         Reviewed by Chris Dumez.
173
174         Tests: imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html
175                imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html
176
177         Removing FetchRequest type getter.
178         Merging Type and Destination as per https://fetch.spec.whatwg.org/#concept-request-destination.
179         Setting destination of request within CachedResourceLoader as this will be useful to Service Workers.
180
181         * Modules/fetch/FetchRequest.h:
182         * Modules/fetch/FetchRequest.idl:
183         * loader/FetchOptions.h:
184         (WebCore::FetchOptions::isolatedCopy const):
185         (WebCore::FetchOptions::FetchOptions):
186         (WebCore::FetchOptions::encode const):
187         (WebCore::FetchOptions::decode):
188         * loader/ThreadableLoader.cpp:
189         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
190         * loader/cache/CachedResourceLoader.cpp:
191         (WebCore::CachedResourceLoader::requestImage):
192         (WebCore::CachedResourceLoader::requestFont):
193         (WebCore::CachedResourceLoader::requestTextTrack):
194         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
195         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
196         (WebCore::CachedResourceLoader::requestScript):
197         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
198         (WebCore::CachedResourceLoader::requestMedia):
199         (WebCore::CachedResourceLoader::requestIcon):
200         (WebCore::CachedResourceLoader::requestRawResource):
201         (WebCore::CachedResourceLoader::requestBeaconResource):
202         (WebCore::CachedResourceLoader::requestMainResource):
203         * loader/cache/CachedResourceRequest.cpp:
204         (WebCore::CachedResourceRequest::setDestinationIfNotSet):
205         * loader/cache/CachedResourceRequest.h:
206
207 2017-10-15  Ryosuke Niwa  <rniwa@webkit.org>
208
209         Cannot access images included in the content pasted from Microsoft Word
210         https://bugs.webkit.org/show_bug.cgi?id=124391
211         <rdar://problem/26862741>
212
213         Reviewed by Antti Koivisto.
214
215         The bug is caused by the fact Microsoft Word generates HTML content which references an image using file URL.
216         Because the websites don't have access to arbtirary file URLs, this prevents editors such as TinyMCE to save
217         those images.
218
219         This patch fixes the problem by converting file URLs for images and all other subresources in the web archive
220         generated by Microsoft Word by blob URLs like r222839 for RTF/RTFD and r222119 for images.
221
222         To avoid revealing privacy sensitive information such as the absolute local file path to the user's home directory
223         Microsoft Word and other applications in the system includes in the web archive placed in the system pasteboard,
224         this patch also introduces the mechanism to sanitize when the HTML content is read by DataTransfer's getData.
225
226         This patch also introduces the sanitization for when writing HTML into the pasteboard since other applications
227         in the syste which is capable to processing web archives are not necessarily equipped to pretect itself and the
228         rest of the system from potentially dangerous JavaScript included in the web archive placed in the system pasteboard.
229
230         Finally, this patch expands the list of clipboard types that are exposed as "text/html" to the Web platform by
231         adding the capability to convert RTF, RTFD, and web archive into HTML markup by introducing WebContentMarkupReader,
232         a new subclass of PasteboardWebContentReader which creates a HTML markup instead of a document fragment. Most of
233         the sanitization process happens in this new class, and will be expanded to WebContentReader to make pasting safer.
234
235         Tests: editing/pasteboard/data-transfer-get-data-on-pasting-html-uses-blob-url.html
236                editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying-in-null-origin.html
237                editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying.html
238                editing/pasteboard/data-transfer-set-data-sanitlize-html-when-dragging-in-null-origin.html
239                http/tests/security/clipboard/copy-paste-html-across-origin-sanitizes-html.html
240                CopyHTML.Sanitizes
241                DataInteractionTests.DataTransferSanitizeHTML
242                PasteRTF.ExposesHTMLTypeInDataTransfer
243                PasteRTFD.ExposesHTMLTypeInDataTransfer
244                PasteRTFD.ImageElementUsesBlobURLInHTML
245                PasteWebArchive.ExposesHTMLTypeInDataTransfer
246
247         * dom/DataTransfer.cpp:
248         (WebCore::originIdentifierForDocument): Moved to Document::originIdentifierForPasteboard.
249         (WebCore::DataTransfer::createForCopyAndPaste):
250         (WebCore::DataTransfer::getDataForItem const): Use WebContentMarkupReader read HTMl content so that we can read
251         web arhive, RTF, and RTFD as text/html.
252         (WebCore::DataTransfer::getData const):
253         (WebCore::DataTransfer::setData):
254         (WebCore::DataTransfer::setDataFromItemList): Sanitize the HTML before placing into the system pasteboard.
255         (WebCore::DataTransfer::createForDragStartEvent):
256         (WebCore::DataTransfer::createForDrop):
257         (WebCore::DataTransfer::createForUpdatingDropTarget):
258         * dom/DataTransfer.h:
259         * dom/DataTransfer.idl:
260         * dom/DataTransferItem.cpp:
261         (WebCore::DataTransferItem::getAsString const):
262         * dom/Document.cpp:
263         (WebCore::Document::originIdentifierForPasteboard): Renamed from uniqueIdentifier. Moved the code to use the origin
264         string and then falling back to the UUID here from originIdentifierForDocument in DataTransfer.cpp.
265         * dom/Document.h:
266         * editing/WebContentReader.cpp:
267         (WebCore::WebContentMarkupReader::shouldSanitize const): Added.
268         * editing/WebContentReader.h:
269         (WebCore::WebContentMarkupReader): Added.
270         (WebCore::WebContentMarkupReader::WebContentMarkupReader):
271         * editing/cocoa/WebContentReaderCocoa.mm:
272         (WebCore::createFragmentFromWebArchive): Extracted out of WebContentReader::readWebArchive to share code.
273         (WebCore::WebContentReader::readWebArchive):
274         (WebCore::WebContentMarkupReader::readWebArchive): Added. Reads the web archive, replace all subresource URLs by
275         blob URLs, and re-generate the markup using our copy & paste code. The last step is requied to strip away any privacy
276         sensitive information as well as potentially dangerous JavaScript code.
277         (WebCore::stripMicrosoftPrefix): Extracted out of WebContentReader::readHTML to share code.
278         (WebCore::WebContentReader::readHTML):
279         (WebCore::WebContentMarkupReader::readHTML): Added. Only sanitize the markup when it comes from a different origin.
280         (WebCore::WebContentReader::readRTFD): Added a nullity check for frame.document().
281         (WebCore::WebContentMarkupReader::readRTFD): Added.
282         (WebCore::WebContentMarkupReader::readRTF): Added.
283         * editing/markup.h:
284         * editing/markup.cpp:
285         (WebCore::createPageForSanitizingWebContent): Added.
286         (WebCore::sanitizeMarkup): Added. This function "pastes" the markup into a new isolated document then reserializes
287         using our serialization code for copy. It strips away all invisible information such as comments, and strips away
288         event handlers and script elements to remove potentially dangerous scripts.
289         * platform/Pasteboard.h:
290         * platform/ios/PasteboardIOS.mm:
291         (WebCore::Pasteboard::readPasteboardWebContentDataForType): Now that this code can be called by DataTransfer, added
292         the checks for the change count to make sure we stop letting web content read if the pasteboard had been changed by
293         some other applications. To do this, turned this function into a member of Pasteboard. Also changed the return type
294         to an enum with tri-state to exist the loop early in the call sites.
295         (WebCore::Pasteboard::read):
296         (WebCore::Pasteboard::readRespectingUTIFidelities):
297         * platform/ios/PlatformPasteboardIOS.mm:
298         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML.
299         * platform/mac/PasteboardMac.mm:
300         (WebCore::Pasteboard::read): Add the change count checks now that this code can be called by DataTransfer.
301         * platform/mac/PlatformPasteboardMac.mm:
302         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML.
303
304 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
305
306         Unreviewed attempt to fix the Windows debug build.
307
308         * Modules/webdatabase/DatabaseTracker.cpp:
309         (WebCore::DatabaseTracker::deleteOrigin):
310
311 2017-10-16  Chris Dumez  <cdumez@apple.com>
312
313         Log using differential privacy domains where the WebContent process crashes
314         https://bugs.webkit.org/show_bug.cgi?id=178346
315         <rdar://problem/33293830>
316
317         Reviewed by Alex Christensen.
318
319         Add new diagnostic logging key for domain causing crashes.
320
321         * page/DiagnosticLoggingKeys.cpp:
322         (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey):
323         * page/DiagnosticLoggingKeys.h:
324
325 2017-10-16  Sam Weinig  <sam@webkit.org>
326
327         [Settings] Remove all custom code from Settings.h/cpp
328         https://bugs.webkit.org/show_bug.cgi?id=178330
329
330         Reviewed by Simon Fraser.
331
332         Removes the two remaining functions out of Settings paving the way
333         for the file to be generated.
334         
335         - pageDestroyed was moved down into SettingsBase.
336         - effectiveFrameFlattening was moved to FrameView (to reduce the need
337           for additional includes, the FrameFlattening enum was converted to
338           an enum class to allow it to be forward declared).
339           
340         Also moves default values into SettingsDefaultValues.h
341
342         * WebCore.xcodeproj/project.pbxproj:
343         
344             Add new files.
345         
346         * page/FrameView.cpp:
347         * page/FrameView.h:
348
349             Move effectiveFrameFlattening function here from Settings.
350
351         * page/Settings.cpp:
352         * page/Settings.h:
353
354             Move effectiveFrameFlattening, pageDestroyed and default values out.
355
356         * page/Settings.in:
357         
358             Update for turning FrameFlattening into an enum class.
359         
360         * page/SettingsBase.h:
361
362             Turn FrameFlattening into an enum class and move pageDestroyed here.
363
364         * page/SettingsDefaultValues.h: Added.
365
366             Move all the default values from Settings here.
367
368         * rendering/RenderFrameSet.cpp:
369         * rendering/RenderIFrame.cpp:
370         * rendering/RenderView.cpp:
371
372             Get effectiveFrameFlattening from the FrameView.
373
374         * testing/InternalSettings.cpp:
375         * testing/InternalSettings.h:
376         
377             Update now that FrameFlattening is an enum class.
378
379 2017-10-16  Maureen Daum  <mdaum@apple.com>
380
381         If we fail to delete any database file, don't remove its information from the tracker database
382         <rdar://problem/34576132> and https://bugs.webkit.org/show_bug.cgi?id=178251
383
384         Reviewed by Brady Eidson.
385
386         New tests:
387         DatabaseTracker.DeleteDatabase
388         DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist
389         DatabaseTracker.DeleteOrigin
390         DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails
391         DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist
392
393         * Modules/webdatabase/DatabaseTracker.cpp:
394         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
395         If the database doesn't exist, we previously deleted it but failed to remove the
396         information from the tracker database. We still want to delete all of the information
397         associated with this database from the tracker database, so add it to databaseNamesToDelete.
398         (WebCore::DatabaseTracker::deleteOrigin):
399         If a database doesn't exist, don't try to delete it. We don't need to, but more
400         importantly, deleteDatabaseFile() will fail if the database doesn't exist, which
401         will cause us to incorrectly think we failed to remove database information from disk.
402         If we actually fail to delete any database file, return before we remove the origin
403         information from the tracker database so we don't lose track of the database.
404         (WebCore::DatabaseTracker::deleteDatabase):
405         If a database doesn't exist, don't try to delete it. We don't need to, but also it
406         will cause us to incorrectly think that we were unable to delete a database, so we
407         would bail before we remove the database information from the tracker database. We
408         want to remove the database information from the tracker database because the database
409         doesn't exist.
410         * Modules/webdatabase/DatabaseTracker.h:
411         Expose fullPathForDatabase() for use by tests.
412         * platform/Logging.h:
413         Add a logging channel.
414
415 2017-10-16  Alex Christensen  <achristensen@webkit.org>
416
417         Remove unnecessary include from Document.h
418         https://bugs.webkit.org/show_bug.cgi?id=178247
419
420         Reviewed by Darin Adler.
421
422         * dom/Document.cpp:
423         (WebCore::Document::hasTouchEventHandlers const):
424         (WebCore::Document::touchEventTargetsContain const):
425         * dom/Document.h:
426         (WebCore::Document::hasTouchEventHandlers const): Deleted.
427         (WebCore::Document::touchEventTargetsContain const): Deleted.
428
429 2017-10-16  Alex Christensen  <achristensen@webkit.org>
430
431         Fix iOS build after r223422
432         https://bugs.webkit.org/show_bug.cgi?id=178251
433
434         * Modules/webdatabase/DatabaseManager.h:
435
436 2017-10-16  Maureen Daum  <mdaum@apple.com>
437
438         We should wrap the removal of information from the tracker database in a transaction in DatabaseTracker::deleteOrigin()
439         https://bugs.webkit.org/show_bug.cgi?id=178274
440         <rdar://problem/34576132>
441
442         Reviewed by Tim Horton.
443
444         * Modules/webdatabase/DatabaseTracker.cpp:
445         (WebCore::DatabaseTracker::deleteOrigin):
446         Wrap the removal of information from the tracker database in a transaction so that
447         we don't end up in a case where only one of the tables contains information about
448         an origin.
449         If anything goes wrong when we're modifying the tracker database, rollback the transaction
450         before bailing.
451
452 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
453
454         Unreviewed, rolling out r223419.
455
456         This change broke the Windows build.
457
458         Reverted changeset:
459
460         "If we fail to delete any database file, don't remove its
461         information from the tracker database"
462         https://bugs.webkit.org/show_bug.cgi?id=178251
463         https://trac.webkit.org/changeset/223419
464
465 2017-10-16  Maureen Daum  <mdaum@apple.com>
466
467         If we fail to delete any database file, don't remove its information from the tracker database
468         <rdar://problem/34576132> and https://bugs.webkit.org/show_bug.cgi?id=178251
469
470         Reviewed by Brady Eidson.
471
472         New tests:
473         DatabaseTracker.DeleteDatabase
474         DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist
475         DatabaseTracker.DeleteOrigin
476         DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails
477         DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist
478
479         * Modules/webdatabase/DatabaseTracker.cpp:
480         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
481         If the database doesn't exist, we previously deleted it but failed to remove the
482         information from the tracker database. We still want to delete all of the information
483         associated with this database from the tracker database, so add it to databaseNamesToDelete.
484         (WebCore::DatabaseTracker::deleteOrigin):
485         If a database doesn't exist, don't try to delete it. We don't need to, but more
486         importantly, deleteDatabaseFile() will fail if the database doesn't exist, which
487         will cause us to incorrectly think we failed to remove database information from disk.
488         If we actually fail to delete any database file, return before we remove the origin
489         information from the tracker database so we don't lose track of the database.
490         (WebCore::DatabaseTracker::deleteDatabase):
491         If a database doesn't exist, don't try to delete it. We don't need to, but also it
492         will cause us to incorrectly think that we were unable to delete a database, so we
493         would bail before we remove the database information from the tracker database. We
494         want to remove the database information from the tracker database because the database
495         doesn't exist.
496         * Modules/webdatabase/DatabaseTracker.h:
497         Expose fullPathForDatabase() for use by tests.
498         * platform/Logging.h:
499         Add a logging channel.
500
501 2017-10-16  Brent Fulgham  <bfulgham@apple.com>
502
503         REGRESSION(223307): ASSERTION in WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution
504         https://bugs.webkit.org/show_bug.cgi?id=178342
505         <rdar://problem/35008505>
506
507         Reviewed by Chris Dumez.
508
509         In r223307 I mistakenly used 'topDocument->topDocument()' because of a copy/paste error. I should have just used
510         'topDocument'.
511
512         Tests: CommandBackForwardTestWKWebView in TestWebKitAPI.
513
514         * loader/ResourceLoadObserver.cpp:
515         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): We might enter this routine at a time
516         where there is no page. If so, we should return early and not log credit.
517         * page/EventHandler.cpp:
518         (WebCore::EventHandler::keyEvent): Correct the argument passed to the log function.
519
520 2017-10-15  Filip Pizlo  <fpizlo@apple.com>
521
522         Make some asserts into release asserts
523         https://bugs.webkit.org/show_bug.cgi?id=178324
524
525         Reviewed by Saam Barati.
526
527         No new tests because no change in behavior.
528         
529         This introduces some release asserts. Perf testing shows that it's neutral. So, we get some extra
530         safety without losing any perf.
531
532         * dom/ContainerNodeAlgorithms.cpp:
533         (WebCore::notifyChildNodeInserted):
534         * dom/Document.cpp:
535         (WebCore::Document::adoptNode):
536         (WebCore::Document::frameDestroyed):
537         (WebCore::Document::attachToCachedFrame):
538         (WebCore::Document::detachFromCachedFrame):
539         (WebCore::Document::prepareForDestruction):
540         (WebCore::Document::dispatchWindowEvent):
541         (WebCore::Document::dispatchWindowLoadEvent):
542         (WebCore::Document::applyQuickLookSandbox):
543         * dom/DocumentOrderedMap.cpp:
544         (WebCore::DocumentOrderedMap::add):
545         (WebCore::DocumentOrderedMap::remove):
546         (WebCore::DocumentOrderedMap::get const):
547         (WebCore:: const):
548         * dom/Node.cpp:
549         (WebCore::Node::~Node):
550         (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope):
551         (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall):
552         (WebCore::moveNodeToNewDocument):
553         (WebCore::moveShadowTreeToNewDocument):
554         (WebCore::Node::moveTreeToNewScope):
555         (WebCore::Node::didMoveToNewDocument):
556         (WebCore::Node::dispatchSubtreeModifiedEvent):
557         (WebCore::Node::dispatchDOMActivateEvent):
558
559 2017-10-16  Alejandro G. Castro  <alex@igalia.com>
560
561         Make RealtimeIncomingAudioSources and RealtimeOutgoingAudioSources port agnostic
562         https://bugs.webkit.org/show_bug.cgi?id=177928
563
564         Reviewed by Youenn Fablet.
565
566         Refactor the RealtimeIncomingAudioSource and RealtimeOutgoingAudioSource classes,
567         move the mac specific code to a different class. This way we can use them from
568         other ports.
569
570         No new tests, we are not adding new functionality just refactoring.
571
572         * CMakeLists.txt:
573         * WebCore.xcodeproj/project.pbxproj:
574         * platform/mediastream/RealtimeIncomingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Just the port agnostic parts.
575         * platform/mediastream/RealtimeIncomingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Ditto.
576         * platform/mediastream/RealtimeOutgoingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp. Ditto.
577         * platform/mediastream/RealtimeOutgoingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h. Ditto.
578         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: Added, it adds Cocoa code parts from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp.
579         (WebCore::RealtimeIncomingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there.
580         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h.
581         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp.
582         (WebCore::RealtimeOutgoingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there.
583         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: Added Cocoa code from the original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h.
584
585 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
586
587         Unreviewed, fix the tvOS build after r223340.
588
589         Add a new #define in PlatformPasteboardIOS.mm for item provider support, and guard usages of
590         WebItemProviderPasteboard using it.
591
592         * platform/ios/PlatformPasteboardIOS.mm:
593         (WebCore::pasteboardMayContainFilePaths):
594         (WebCore::PlatformPasteboard::readURL):
595
596 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
597
598         Unreviewed, rolling out r223271.
599
600         This change introduced LayoutTest failures on WK1.
601
602         Reverted changeset:
603
604         "Use asynchronous ResourceHandleClient calls for WebKit1"
605         https://bugs.webkit.org/show_bug.cgi?id=160677
606         https://trac.webkit.org/changeset/223271
607
608 2017-10-16  Alejandro G. Castro  <alex@igalia.com>
609
610         Make RealtimeIncomingVideoSources and RealtimeOutgoingVideoSources port agnostic
611         https://bugs.webkit.org/show_bug.cgi?id=177869
612
613         Reviewed by Youenn Fablet.
614
615         Refactor the RealtimeIncomingVideoSource and RealtimeOutgoingVideoSource classes,
616         move the cocoa specific code to a different class. This way we can use them from
617         other ports.
618
619         No new functionality, just a refactor.
620
621         * CMakeLists.txt:
622         * WebCore.xcodeproj/project.pbxproj:
623         * platform/mediastream/RealtimeIncomingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. Just the port agnostic parts.
624         * platform/mediastream/RealtimeIncomingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. DItto
625         * platform/mediastream/RealtimeOutgoingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp. Ditto
626         * platform/mediastream/RealtimeOutgoingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h. Ditto
627         * platform/mediastream/mac/RealtimeIncomingVideoSourceMac.cpp: Added, it adds the Cocoa specific parts from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.cpp.
628         (WebCore::RealtimeIncomingVideoSource::create): Moved this function from the base class, it allows avoiding the include.
629         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: Added, cocoa dependent code from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h.
630         (WebCore::RealtimeOutgoingVideoSource::create): Moved this funtion from the base class, now we can use the Cocoa create without including it in the base class.
631         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: Added, cocoa dependent code.
632         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: Added, cocoa dependent code.
633
634 2017-10-16  Manuel Rego Casasnovas  <rego@igalia.com>
635
636         Don't use intrinsic width if our container's width is zero
637         https://bugs.webkit.org/show_bug.cgi?id=178073
638
639         Reviewed by Sergio Villar Senin.
640
641         Based on Blink r173212 by <robhogan@gmail.com>.
642         https://chromium.googlesource.com/chromium/src/+/1592e8a1e8e56dfa6e5d709c50b129ae659c2fad
643
644         Since at least r798 we use a replaced element's intrinsic width
645         if its containing block has a width of zero. As a result our rendering
646         of width100percent-image.html has disagreed with all other browsers
647         and we display replaced elements when they should be invisible.
648
649         Test: fast/replaced/container-width-zero.html
650
651         * rendering/RenderBox.cpp:
652         (WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
653         If our container has zero width then let our width be zero too.
654
655 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
656
657         On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image
658         https://bugs.webkit.org/show_bug.cgi?id=178301
659         <rdar://problem/34990050>
660
661         Reviewed by Darin Adler.
662
663         After r222656, we consider images on the pasteboard to be files. This causes DataTransfer.getData to return the
664         empty string for all types, which brings back https://bugs.webkit.org/show_bug.cgi?id=170637. To allow pages to
665         access the URL part of a dragged image, we exempt "text/uri-list" from our heurstics to hide pasteboard data
666         which may contain files, and return the URL as long as its protocol is either HTTP or HTTPS.
667
668         Tweaked an existing layout test to cover this scenario, as well as the scenario in which the dragged image links
669         to a file URL (in which case we should avoid exposing the data).
670
671         Test: editing/pasteboard/drag-drop-href-as-url.html
672               DataInteractionTests.DataTransferGetDataWhenDroppingImageWithHTTPURL
673
674         * dom/DataTransfer.cpp:
675         (WebCore::DataTransfer::getDataForItem const):
676
677         When the pasteboard contains files, allow data for "text/uri-list" to be returned, as long as the URL string has
678         a white-listed protocol (currently, this is just http and https).
679
680         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
681         (WebCore::DataTransfer::setData):
682         (WebCore::DataTransfer::types const):
683
684         When the pasteboard contains files, allow "text/uri-list" to be added, alongside the "Files" type, if it would
685         have been exposed in the list of safe DOM types.
686
687         * dom/DataTransfer.h:
688         * platform/Pasteboard.cpp:
689         (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles):
690
691         Add a new helper method to determine whether it is safe to expose an URL string as "text/uri-list" to bindings,
692         if the pasteboard contains files. While this currently checks whether or not the URL is in the HTTP family, we
693         may want to consider tweaking this to blacklist the "file" protocol instead, and allow all other valid URLs by
694         default.
695
696         * platform/Pasteboard.h:
697         * platform/PlatformPasteboard.h:
698         * platform/ios/PlatformPasteboardIOS.mm:
699         (WebCore::pasteboardMayContainFilePaths):
700         (WebCore::PlatformPasteboard::stringForType const):
701
702         Mark stringForType as const, and also teach stringForType to return the null string for the platform URL type if
703         the pasteboard might contain file paths.
704
705         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
706
707         Before coercing a platform type to "text/uri-list" when building the list of DOM-safe types, check that the
708         stringForType is not the empty string, in which case we don't expose the type to the DOM at all. This ensures
709         that in cases where the URL might reveal a file path, we don't advertise "text/uri-list" as a type. We adopt a
710         similar strategy on iOS.
711
712         (WebCore::PlatformPasteboard::stringForType): Deleted.
713         * platform/mac/PlatformPasteboardMac.mm:
714         (WebCore::pasteboardMayContainFilePaths):
715         (WebCore::PlatformPasteboard::stringForType const):
716         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
717         (WebCore::PlatformPasteboard::stringForType): Deleted.
718
719 2017-10-16  Frederic Wang  <fwang@igalia.com>
720
721         Use auto/nullptr in scrolling code
722         https://bugs.webkit.org/show_bug.cgi?id=178306
723
724         Reviewed by Carlos Garcia Campos.
725
726         This patch modifies the scrolling code to use the auto keyword when
727         possible. It also replaces '0' with 'nullptr' for the return value of
728         ScrollingStateTree::stateNodeForID.
729
730         No new tests, behavior unchanged.
731
732         * page/scrolling/AsyncScrollingCoordinator.cpp:
733         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
734         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
735         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
736         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
737         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
738         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
739         (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
740         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
741         (WebCore::AsyncScrollingCoordinator::updateNodeLayer):
742         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints):
743         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
744         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition):
745         (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices):
746         * page/scrolling/ScrollingCoordinator.cpp:
747         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView const):
748         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
749         (WebCore::ScrollingCoordinator::scrollLayerForFrameView):
750         (WebCore::ScrollingCoordinator::headerLayerForFrameView):
751         (WebCore::ScrollingCoordinator::footerLayerForFrameView):
752         (WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView):
753         (WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
754         (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
755         (WebCore::ScrollingCoordinator::rootContentLayerForFrameView):
756         (WebCore::ScrollingCoordinator::handleWheelEventPhase):
757         (WebCore::ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects const):
758         (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasonsForAllFrames):
759         (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText const):
760         * page/scrolling/ScrollingStateFixedNode.cpp:
761         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
762         * page/scrolling/ScrollingStateStickyNode.cpp:
763         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
764         * page/scrolling/ScrollingStateTree.cpp:
765         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
766         (WebCore::ScrollingStateTree::attachNode):
767         (WebCore::ScrollingStateTree::detachNode):
768         (WebCore::ScrollingStateTree::removeNodeAndAllDescendants):
769         (WebCore::ScrollingStateTree::stateNodeForID const):
770         * page/scrolling/ScrollingTree.cpp:
771         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
772         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
773         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
774         (WebCore::ScrollingTree::commitTreeState):
775         (WebCore::ScrollingTree::updateTreeFromStateNode):
776         * page/scrolling/ScrollingTreeNode.cpp:
777         (WebCore::ScrollingTreeNode::enclosingFrameNode const):
778         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
779         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree):
780         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer):
781         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints):
782         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange):
783         (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea):
784
785 2017-10-16  Fujii Hironori  <Hironori.Fujii@sony.com>
786
787         A lot of "Can't stat WebCore/animation: No such file or directory" since r223328
788         https://bugs.webkit.org/show_bug.cgi?id=178326
789
790         Unreviewed build fix
791
792         The directory WebCore/animation was removed in r223328.
793
794         No new tests because there is no behavior change.
795
796         * CMakeLists.txt: Removed animation from
797         WebCore_INCLUDE_DIRECTORIES and WebCore_IDL_INCLUDES.
798         * DerivedSources.make: Removed animation from VPATH and IDL_INCLUDES
799
800 2017-10-16  Frederic Wang  <fwang@igalia.com>
801
802         Replace some ScrollingTreeNode::nodeType() calls with is*Node()
803         https://bugs.webkit.org/show_bug.cgi?id=178259
804
805         Reviewed by Darin Adler.
806
807         No new tests, behavior unchanged.
808
809         * page/scrolling/AsyncScrollingCoordinator.cpp:
810         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
811         * page/scrolling/ScrollingStateNode.h:
812         (WebCore::ScrollingStateNode::isScrollingNode const):
813         * page/scrolling/ScrollingTree.cpp:
814         (WebCore::ScrollingTree::updateTreeFromStateNode):
815         * page/scrolling/ScrollingTreeNode.cpp:
816         (WebCore::ScrollingTreeNode::enclosingFrameNode const):
817         * page/scrolling/ScrollingTreeNode.h:
818         (WebCore::ScrollingTreeNode::isScrollingNode const):
819
820 2017-10-16  Tomas Popela  <tpopela@redhat.com>
821
822         DataTransfer.cpp triggers -Wunused-but-set-variable
823         https://bugs.webkit.org/show_bug.cgi?id=178209
824
825         Reviewed by Wenson Hsieh.
826
827         Use the ASSERT_UNUSED to silence it.
828
829         * dom/DataTransfer.cpp:
830         (WebCore::DataTransfer::filesFromPasteboardAndItemList const):
831
832 2017-10-15  Sam Weinig  <sam@webkit.org>
833
834         [Settings] Split non-macro generated parts of Settings into SettingsBase base class
835         https://bugs.webkit.org/show_bug.cgi?id=178321
836
837         Reviewed by Darin Adler.
838
839         Working towards getting generated Settings working again, but in smaller patches, split
840         non-generated part off into SettingsBase as a first step.
841         
842         One function, effectiveFrameFlattening(), needs to remain in Settings for now, as it directly
843         references a macro generated function, frameFlattening().
844
845         * CMakeLists.txt:
846         * WebCore.xcodeproj/project.pbxproj:
847         * page/Page.h:
848         * page/Settings.cpp:
849         * page/Settings.h:
850         * page/SettingsBase.h: Copied from Source/WebCore/page/Settings.h.
851         * page/cocoa/SettingsBaseCocoa.mm: Copied from Source/WebCore/page/cocoa/SettingsCocoa.mm.
852         * page/cocoa/SettingsCocoa.mm: Removed.
853
854 2017-10-15  Yusuke Suzuki  <utatane.tea@gmail.com>
855
856         [JSC] Perform module specifier validation at parsing time
857         https://bugs.webkit.org/show_bug.cgi?id=178256
858
859         Reviewed by Darin Adler.
860
861         No behavior change in the current implementation.
862
863         * bindings/js/JSDOMWindowBase.cpp:
864         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
865         * bindings/js/JSDOMWindowBase.h:
866         * bindings/js/ScriptModuleLoader.cpp:
867         (WebCore::ScriptModuleLoader::resolve):
868         * bindings/js/ScriptModuleLoader.h:
869
870 2017-10-15  Chris Dumez  <cdumez@apple.com>
871
872         DOMTokenList shouldn't add empty attributes
873         https://bugs.webkit.org/show_bug.cgi?id=178280
874         <rdar://problem/34987431>
875
876         Reviewed by Ryosuke Niwa.
877
878         Follow-up to r223306, reverse the check conditions to avoid attribute
879         lookup when possible. Also use m_tokens instead of tokens() to avoid
880         unnecessary branch.
881
882         * html/DOMTokenList.cpp:
883         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
884
885 2017-10-15  Darin Adler  <darin@apple.com>
886
887         UTF-8 decoding produces one replacement character per byte; Encoding standard requires one replacement character per illegal sequence instead
888         https://bugs.webkit.org/show_bug.cgi?id=178207
889
890         Reviewed by Sam Weinig.
891
892         * platform/text/TextCodecUTF8.cpp:
893         (WebCore::TextCodecUTF8::create): Deleted. Use a lambda instead.
894         (WebCore::TextCodecUTF8::registerCodecs): Use a lambda.
895         (WebCore::nonASCIISequenceLength): Changed to return 0 instead of 2 for the range 80-C1 since
896         none of those are valid sequence leading characters.
897         (WebCore::decodeNonASCIISequence): Changed the length argument to be in/out so the caller
898         knows how much of the sequence we decoded for failure cases. Simplified the length 2 section.
899         (WebCore::TextCodecUTF8::handleError): Deleted.
900         (WebCore::TextCodecUTF8::handlePartialSequence): Changed this into a pair of plain functions
901         rather than two template function specializations since the two functions are rather different.
902         For the one-byte version, got rid of the unused arguments. For the two-byte version, got rid
903         of the ignored return value, stopped using the handleError function since each error case
904         needs to be handled differently. In each error case consume the entire incorrect sequence
905         instead of just one byte.
906         (WebCore::TextCodecUTF8::decode): Updated for the above change, and changed the non-partial
907         incorrect sequence to consume the entire incorrect sequence instead of just one byte. Also
908         use WTF prefixes explicitly so we don't  have to do "using namespace".
909         (WebCore::TextCodecUTF8::encode): Got rid of unneeded type punning, and added some inline
910         capacity to save one memory allocation when encoding shorter strings.
911
912         * platform/text/TextCodecUTF8.h: Use pragma once. Intialize m_partialSequenceSize where it
913         is defined and let the compiler generate the constructor. Updated for the changes above.
914
915         * platform/text/TextEncoding.h: Export a constructor now used by a unit test.
916         * platform/text/TextEncodingRegistry.h: Export newTextCodec, now used by a unit test.
917
918 2017-10-14  Antoine Quint  <graouts@apple.com>
919
920         Remove all Web Animations code
921         https://bugs.webkit.org/show_bug.cgi?id=178273
922
923         Reviewed by Sam Weinig.
924
925         We remove all existing code related to Web Animations which does not include any functionality,
926         only stubs. This leaves the build and runtime flags, we'll start a complete implementation from
927         scratch.
928
929         * CMakeLists.txt:
930         * DerivedSources.make:
931         * WebCore.xcodeproj/project.pbxproj:
932         * animation/Animatable.idl: Removed.
933         * animation/AnimationEffect.cpp: Removed.
934         * animation/AnimationEffect.h: Removed.
935         * animation/AnimationEffect.idl: Removed.
936         * animation/AnimationTimeline.cpp: Removed.
937         * animation/AnimationTimeline.h: Removed.
938         * animation/AnimationTimeline.idl: Removed.
939         * animation/DocumentAnimation.cpp: Removed.
940         * animation/DocumentAnimation.h: Removed.
941         * animation/DocumentAnimation.idl: Removed.
942         * animation/DocumentTimeline.cpp: Removed.
943         * animation/DocumentTimeline.h: Removed.
944         * animation/DocumentTimeline.idl: Removed.
945         * animation/KeyframeEffect.cpp: Removed.
946         * animation/KeyframeEffect.h: Removed.
947         * animation/KeyframeEffect.idl: Removed.
948         * animation/WebAnimation.cpp: Removed.
949         * animation/WebAnimation.h: Removed.
950         * animation/WebAnimation.idl: Removed.
951         * bindings/js/JSAnimationTimelineCustom.cpp: Removed.
952         * bindings/js/JSBindingsAllInOne.cpp:
953         * bindings/js/WebCoreBuiltinNames.h:
954         * dom/Element.cpp:
955         (WebCore::Element::getAnimations): Deleted.
956         * dom/Element.h:
957         * dom/Element.idl:
958
959 2017-10-14  Devin Rousso  <webkit@devinrousso.com>
960
961         Web Inspector: provide a way to enable/disable event listeners
962         https://bugs.webkit.org/show_bug.cgi?id=177451
963
964         Reviewed by Joseph Pecoraro.
965
966         Test: inspector/dom/setEventListenerDisabled.html
967
968         * dom/EventTarget.cpp:
969         (WebCore::EventTarget::fireEventListeners):
970         Add InspectorInstrumentation call to isEventListenerDisabled. If true, the event listener's
971         callback will not be called.
972
973         * inspector/InspectorDOMAgent.h:
974         * inspector/InspectorDOMAgent.cpp:
975         (WebCore::InspectorDOMAgent::discardBindings):
976         (WebCore::InspectorDOMAgent::getEventListenersForNode):
977         (WebCore::InspectorDOMAgent::setEventListenerDisabled):
978         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
979         (WebCore::InspectorDOMAgent::willRemoveEventListener):
980         (WebCore::InspectorDOMAgent::isEventListenerDisabled):
981         Introduce a mapping of `EventListener*` to `InspectorEventListener`, a struct for uniquely
982         identifying event listeners so they can be referenced from the frontend. We only add items
983         to this mapping when `getEventListenersForNode` is called, as that is when EventListener
984         data is sent to the frontend. This allows us to defer creating an Inspector "mirror" object
985         for each EventListener until it is needed. Items are removed whenever an event listener is
986         removed or when the document changes.
987
988         * inspector/InspectorInstrumentation.h:
989         (WebCore::InspectorInstrumentation::isEventListenerDisabled):
990         * inspector/InspectorInstrumentation.cpp:
991         (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl):
992         (WebCore::InspectorInstrumentation::isEventListenerDisabledImpl):
993         Pass additional parameters to InspectorDOMAgent so it can determine if the event listener
994         actually exists. If not, don't dispatch an event to the frontend as nothing will change.
995
996 2017-10-14  Sam Weinig  <sam@webkit.org>
997
998         Remove HashCountedSet's copyToVector functions
999         https://bugs.webkit.org/show_bug.cgi?id=178215
1000
1001         Reviewed by Daniel Bates.
1002
1003         * page/DeviceController.cpp:
1004         (WebCore::DeviceController::dispatchDeviceEvent):
1005         (WebCore::DeviceController::fireDeviceEvent):
1006         
1007             Replace use of HashCountedSet's copyToVector functions with copyToVector(hashCountedSet.values()).
1008
1009 2017-10-13  Jer Noble  <jer.noble@apple.com>
1010
1011         Performance: Skip texture upload if source image and destination texture haven't changed
1012         https://bugs.webkit.org/show_bug.cgi?id=178254
1013         <rdar://problem/34968181>
1014
1015         Reviewed by Dean Jackson.
1016
1017         Update GraphicsContext3D to track which texture is bound to which texture unit, and also to
1018         track when those bound textures have their backing stores modified. This new "seed" value
1019         will be used to determine whether a given texture which has previously had image data
1020         uploaded to it needs to be re-updated.
1021
1022         In VideoTextureCopierCV, track whether the texture's seed changed, whether the IOSurface is
1023         the same,  whether the IOSurface's seed has changed, and whether the "flipY" parameter
1024         changed since the last time the copier was asked to upload to the texture.
1025
1026         * platform/graphics/GraphicsContext3D.h:
1027         (WebCore::GraphicsContext3D::textureSeed):
1028         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture):
1029         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture):
1030         (WebCore::GraphicsContext3D::GraphicsContext3DState::setBoundTexture):
1031         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1032         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1033         * platform/graphics/cv/VideoTextureCopierCV.h:
1034         (WebCore::VideoTextureCopierCV::lastTextureSeed):
1035         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1036         (WebCore::GraphicsContext3D::prepareTexture):
1037         (WebCore::GraphicsContext3D::bindTexture):
1038         (WebCore::GraphicsContext3D::texStorage2D):
1039         (WebCore::GraphicsContext3D::texStorage3D):
1040         (WebCore::GraphicsContext3D::framebufferTexture2D):
1041         (WebCore::GraphicsContext3D::texSubImage2D):
1042         (WebCore::GraphicsContext3D::compressedTexImage2D):
1043         (WebCore::GraphicsContext3D::compressedTexSubImage2D):
1044         (WebCore::GraphicsContext3D::createTexture):
1045         (WebCore::GraphicsContext3D::deleteTexture):
1046         (WebCore::GraphicsContext3D::texImage2DDirect):
1047
1048 2017-10-13  Per Arne Vollan  <pvollan@apple.com>
1049
1050         [Win] When built with VS2017, MiniBrowser crashes on startup.
1051         https://bugs.webkit.org/show_bug.cgi?id=175209
1052
1053         Reviewed by Daniel Bates.
1054
1055         Generated StaticStringImpl objects are not initialized compile-time with VS2017.
1056         When compiling with VS2017, the global, static, StaticStringImpl objects needs to
1057         be defined with the constexpr specifier, in order for the objects to be initialized
1058         at compile time. Since the StaticStringImpl objects will be const then, we need to
1059         be able to create an AtomicString object from a const StaticStringImpl object. 
1060         This constructor has been added to the AtomicString class.
1061
1062         No new tests, covered by existing tests. 
1063
1064         * bindings/scripts/StaticString.pm:
1065         (GenerateStrings):
1066         (GenerateStringAsserts):
1067         * dom/QualifiedName.cpp:
1068         (WebCore::createQualifiedName):
1069         * dom/QualifiedName.h:
1070         * dom/make_names.pl:
1071         (printDefinitions):
1072
1073 2017-10-13  Brent Fulgham  <bfulgham@apple.com>
1074
1075         Protect FrameView during style calculations
1076         https://bugs.webkit.org/show_bug.cgi?id=178300
1077         <rdar://problem/34869329>
1078
1079         Reviewed by Ryosuke Niwa.
1080
1081         Protect the FrameView during layout and style updates in case arbitrary script
1082         is run that might clear it.
1083
1084         Test: fast/html/marquee-reparent-check.html
1085
1086         * page/FrameView.cpp:
1087         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):
1088
1089 2017-10-13  Per Arne Vollan  <pvollan@apple.com>
1090
1091         Crash under ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData
1092         https://bugs.webkit.org/show_bug.cgi?id=178279
1093
1094         Reviewed by Alex Christensen.
1095
1096         Check if the connection is valid before calling ResourceHandleClient::didSendData.
1097
1098         No new tests, covered by existing tests.
1099
1100         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1101         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
1102
1103 2017-10-13  Brent Fulgham  <bfulgham@apple.com>
1104
1105         CMD+R / CMD+Q keyboard shortcuts are treated as user interaction with page
1106         https://bugs.webkit.org/show_bug.cgi?id=178183
1107         <rdar://problem/33327730>
1108
1109         Reviewed by Ryosuke Niwa.
1110
1111         Key events are granted user interaction credit (in terms of updating the last time of user
1112         interaction), even if the key event was not handled. Instead, we should defer granting
1113         access until the key event has been handled.
1114         
1115         Add a new default constructor argument to UserGestureIndicator to be used when handling key
1116         events, so we can delay a decision about whether to grant ResourceLoadStatistics
1117         'hasHadUserInteraction' until we confirm that the event was handled by the page.
1118
1119         This change does not affect other aspects of user interaction.
1120
1121         Tests: fast/events
1122                http/tests/resourceLoadStatistics/prevalent-resource-handled-keydown.html
1123                http/tests/resourceLoadStatistics/prevalent-resource-unhandled-keydown.html
1124
1125         * dom/UserGestureIndicator.cpp:
1126         (WebCore::UserGestureIndicator::UserGestureIndicator): Add check based on constructor argument.
1127         Also: Drive by fix to avoid calling 'currentToken' when not on the main thread.
1128         * dom/UserGestureIndicator.h:
1129         * page/EventHandler.cpp:
1130         (WebCore::EventHandler::keyEvent): If the key event was handled, grant user interaction credit
1131         for ResourceLoadStatistics processing.
1132         (WebCore::EventHandler::internalKeyEvent): Use the new UserGestureIndicator constructor argument.
1133
1134 2017-10-13  Chris Dumez  <cdumez@apple.com>
1135
1136         DOMTokenList shouldn't add empty attributes
1137         https://bugs.webkit.org/show_bug.cgi?id=178280
1138
1139         Reviewed by Ryosuke Niwa.
1140
1141         DOMTokenList shouldn't add empty attributes after:
1142         - https://github.com/whatwg/dom/pull/488
1143
1144         Firefox and Chrome follow the latest spec.
1145
1146         No new tests, updating existing test.
1147
1148         * html/DOMTokenList.cpp:
1149         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
1150         Implement the first step of https://dom.spec.whatwg.org/#concept-dtl-update
1151
1152 2017-10-13  Jer Noble  <jer.noble@apple.com>
1153
1154         Unreviewed build fix; wrap more functions in USE(IOSURFACE) so that
1155         they do not generate "unused function" errors.
1156
1157         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1158
1159 2017-10-13  Jer Noble  <jer.noble@apple.com>
1160
1161         One last unreviewed build fix; since the IOSurface APIs don't exist at
1162         all on the simulator, just wrap the entirety of the implementation of
1163         copyImageToPlatformTexture() in a #if USE(IOSURFACE) check.
1164
1165         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1166         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1167
1168 2017-10-13  Jer Noble  <jer.noble@apple.com>
1169
1170         Unreviewed build fix for the previous build fix; use the right PAL path for IOSurfaceSPI.h.
1171
1172         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1173
1174 2017-10-13  Jer Noble  <jer.noble@apple.com>
1175
1176         Unreviewed build fix; add definitions for IOSurface methods missing on some platforms.
1177
1178         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1179
1180 2017-10-13  Alex Christensen  <achristensen@webkit.org>
1181
1182         Remove Editor::simplifyMarkup
1183         https://bugs.webkit.org/show_bug.cgi?id=178271
1184
1185         Reviewed by Wenson Hsieh.
1186
1187         An API test became flaky, and it turns out this isn't used anywhere, so let's remove it!
1188         It was used in Mountain Lion, Mavericks, and Yosemite, but not since then.
1189         See <rdar://problem/10726177>
1190
1191         * editing/Editor.cpp:
1192         (WebCore::Editor::simplifyMarkup): Deleted.
1193         * editing/Editor.h:
1194
1195 2017-10-13  Jer Noble  <jer.noble@apple.com>
1196
1197         Unreviewed build fix; forward declare the type of IOSurfaceRef.
1198
1199         * platform/cocoa/CoreVideoSoftLink.cpp:
1200         * platform/cocoa/CoreVideoSoftLink.h:
1201
1202 2017-10-13  Jer Noble  <jer.noble@apple.com>
1203
1204         Unreviewed build fix; add soft link macros for newly called CoreVideo methods.
1205
1206         * platform/cocoa/CoreVideoSoftLink.cpp:
1207         * platform/cocoa/CoreVideoSoftLink.h:
1208
1209 2017-10-13  Jer Noble  <jer.noble@apple.com>
1210
1211         Unreviewed build fix; add UNUSED_PARAM macros.
1212
1213         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1214         (WebCore::GraphicsContext3D::texImageIOSurface2D):
1215
1216 2017-10-13  Jer Noble  <jer.noble@apple.com>
1217
1218         Performance: do pixel conformance and texturing in a single step.
1219         https://bugs.webkit.org/show_bug.cgi?id=178219
1220         <rdar://problem/34937237>
1221
1222         Reviewed by Dean Jackson.
1223
1224         No new tests; performance improvements should have no behavior change.
1225
1226         Rather than asking the VTDecompressionSession to conform the output CVPixelBuffer into a
1227         pixel format compatible with OpenGL (& ES), don't constrain the output at all, and only do a
1228         conformance step if the output is not already compatible with OpenGL. This eliminates one
1229         copy (in hardware) operation.
1230
1231         Move the TextureCacheCV object into VideoTextureCopierCV; it will be conditionally used to
1232         create the texture if the pixel buffer is compatible.
1233
1234         Refactor copyVideoTextureToPlatformTexture(CVOpenGLTextureRef) in VideoTextureCopierCV. The
1235         new entry point, copyImageToPlatformTexture(), will attempt to use the texture cache first,
1236         and call a new common copyVideoTextureToPlatformTexture(Platform3DObject) with the result.
1237
1238         The new copyImageToPlatformTexture() will pull planar YUV frames into two textures, and combine
1239         the two with a color transfer function when drawing to the output texture.
1240
1241         * platform/graphics/GraphicsContext3D.h:
1242         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1243         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture):
1244         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
1245         (WebCore::GraphicsContext3D::texImageIOSurface2D):
1246         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1247         (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample):
1248         * platform/graphics/cv/TextureCacheCV.h:
1249         * platform/graphics/cv/TextureCacheCV.mm:
1250         (WebCore::TextureCacheCV::textureFromImage):
1251         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1252         (WebCore::pixelRangeFromPixelFormat):
1253         (WebCore::transferFunctionFromString):
1254         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
1255         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV):
1256         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
1257         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1258         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
1259         * platform/graphics/cv/VideoTextureCopierCV.h:
1260
1261 2017-10-13  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1262
1263         [Readable Streams API] Align queue with spec for ReadableStreamDefaultController
1264         https://bugs.webkit.org/show_bug.cgi?id=178082
1265
1266         Reviewed by Xabier Rodriguez-Calvar.
1267
1268         Implemented new queue behavior for dequeueValue (used by ReadableStreamDefaultController),
1269         which fixes rounding errors (as described in https://github.com/whatwg/streams/pull/661).
1270         Also aligned ReadableByteStreamController queue so that both queues are implemented in
1271         the same way.
1272
1273         No new tests (covered by existing tests, especially WPT tests that now pass).
1274
1275         * Modules/streams/ReadableByteStreamInternals.js:
1276         (privateInitializeReadableByteStreamController): Aligned queue with RSDC.
1277         (readableByteStreamControllerCancel): Aligned queue with RSDC.
1278         (readableByteStreamControllerError): Aligned queue with RSDC.
1279         (readableByteStreamControllerClose): Aligned queue with RSDC.
1280         (readableByteStreamControllerHandleQueueDrain): Aligned queue with RSDC.
1281         (readableByteStreamControllerPull): Aligned queue with RSDC.
1282         (readableByteStreamControllerEnqueue): Aligned queue with RSDC.
1283         (readableByteStreamControllerEnqueueChunk): Aligned queue with RSDC.
1284         (readableByteStreamControllerProcessPullDescriptors): Aligned queue with RSDC.
1285         (readableByteStreamControllerFillDescriptorFromQueue): Aligned queue with RSDC.
1286         (readableByteStreamControllerPullInto): Aligned queue with RSDC.
1287         * Modules/streams/StreamInternals.js:
1288         (dequeueValue): Updated to match spec.
1289         * bindings/js/WebCoreBuiltinNames.h: Removed now useless "totalQueuedBytes".
1290
1291 2017-10-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1292
1293         "text/html" data is not exposed when dragging and dropping across origins
1294         https://bugs.webkit.org/show_bug.cgi?id=178253
1295         <rdar://problem/34971203>
1296
1297         Reviewed by Ryosuke Niwa.
1298
1299         Minor tweak to DataTransfer::setDataFromItemList to allow "text/html" written from bindings to transfer across
1300         origins without requiring a sanitized representation. Currently, sanitizedData is null, which limits "text/html"
1301         to being treated as custom data, inaccessible across origins. We should instead treat markup supplied via
1302         bindings the same way as we do "text/plain" supplied via bindings.
1303
1304         Modified Tests: editing/pasteboard/data-transfer-set-data-sanitize-url-when-copying-in-null-origin.html
1305                         editing/pasteboard/data-transfer-set-data-sanitize-url-when-dragging-in-null-origin.html
1306
1307         * dom/DataTransfer.cpp:
1308         (WebCore::DataTransfer::setDataFromItemList):
1309
1310 2017-10-12  Brady Eidson  <beidson@apple.com>
1311
1312         SW "Hello world".
1313         https://bugs.webkit.org/show_bug.cgi?id=178187
1314
1315         Reviewed by Andy Estes.
1316
1317         No new tests (Covered by changes to existing tests).
1318
1319         With this patch, SW scripts are actually compiled and run inside a ServiceWorkerGlobalScope environment
1320         in the SW context process.
1321
1322         * WebCore.xcodeproj/project.pbxproj:
1323
1324         * bindings/js/WorkerScriptController.cpp:
1325         (WebCore::WorkerScriptController::initScript):
1326
1327         * dom/EventTargetFactory.in:
1328
1329         * workers/WorkerGlobalScope.h:
1330         (WebCore::WorkerGlobalScope::isServiceWorkerGlobalScope const):
1331
1332         * workers/service/ServiceWorkerContextData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
1333         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1334         * workers/service/ServiceWorkerContextData.h:
1335         (WebCore::ServiceWorkerContextData::encode const):
1336         (WebCore::ServiceWorkerContextData::decode):
1337
1338         * workers/service/ServiceWorkerGlobalScope.cpp:
1339         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
1340         (WebCore::ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope):
1341         (WebCore::ServiceWorkerGlobalScope::registration):
1342         (WebCore::ServiceWorkerGlobalScope::eventTargetInterface const):
1343         * workers/service/ServiceWorkerGlobalScope.h:
1344         (WebCore::ServiceWorkerGlobalScope::create):
1345         (WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const):
1346
1347         * workers/service/context/SWContextManager.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
1348         (WebCore::SWContextManager::singleton):
1349         (WebCore::SWContextManager::SWContextManager):
1350         (WebCore::SWContextManager::startServiceWorkerContext):
1351         * workers/service/context/SWContextManager.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.
1352
1353         * workers/service/context/ServiceWorkerThread.cpp: Added.
1354         (WebCore::ServiceWorkerThreadProxy::sharedDummyProxy):
1355         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1356         (WebCore::m_workerObjectProxy):
1357         (WebCore::ServiceWorkerThread::~ServiceWorkerThread):
1358         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1359         (WebCore::ServiceWorkerThread::runEventLoop):
1360         * workers/service/context/ServiceWorkerThread.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.
1361         (WebCore::ServiceWorkerThread::create):
1362         (WebCore::ServiceWorkerThread::workerObjectProxy const):
1363
1364         * workers/service/server/SWServer.cpp:
1365         (WebCore::SWServer::createWorker):
1366
1367 2017-10-12  Alex Christensen  <achristensen@webkit.org>
1368
1369         Use asynchronous ResourceHandleClient calls for WebKit1
1370         https://bugs.webkit.org/show_bug.cgi?id=160677
1371
1372         Reviewed by Brady Eidson.
1373
1374         Covered by existing tests.
1375
1376         * PlatformAppleWin.cmake:
1377         * PlatformMac.cmake:
1378         * WebCore.xcodeproj/project.pbxproj:
1379         * loader/ResourceLoader.cpp:
1380         (WebCore::ResourceLoader::willSendRequestAsync):
1381         (WebCore::ResourceLoader::didReceiveResponseAsync):
1382         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
1383         * loader/ResourceLoader.h:
1384         * loader/appcache/ApplicationCacheGroup.cpp:
1385         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
1386         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
1387         (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync):
1388         (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted.
1389         * loader/appcache/ApplicationCacheGroup.h:
1390         * platform/network/BlobResourceHandle.cpp:
1391         (WebCore::BlobResourceHandle::continueDidReceiveResponse):
1392         (WebCore::BlobResourceHandle::getSizeForNext):
1393         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
1394         (WebCore::BlobResourceHandle::notifyResponseOnError):
1395         * platform/network/PingHandle.h:
1396         * platform/network/ResourceHandle.cpp:
1397         (WebCore::ResourceHandle::didReceiveResponse):
1398         (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted.
1399         * platform/network/ResourceHandle.h:
1400         * platform/network/ResourceHandleClient.cpp:
1401         (WebCore::ResourceHandleClient::~ResourceHandleClient):
1402         (WebCore::ResourceHandleClient::willSendRequest): Deleted.
1403         (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted.
1404         (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted.
1405         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
1406         * platform/network/ResourceHandleClient.h:
1407         (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
1408         (WebCore::ResourceHandleClient::didReceiveResponse): Deleted.
1409         (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted.
1410         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted.
1411         * platform/network/ResourceHandleInternal.h:
1412         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1413         * platform/network/SynchronousLoaderClient.cpp:
1414         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
1415         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
1416         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
1417         (WebCore::SynchronousLoaderClient::didFinishLoading):
1418         (WebCore::SynchronousLoaderClient::didFail):
1419         (WebCore::SynchronousLoaderClient::willSendRequest): Deleted.
1420         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted.
1421         (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted.
1422         * platform/network/SynchronousLoaderClient.h:
1423         * platform/network/cf/ResourceHandleCFNet.cpp:
1424         (WebCore::ResourceHandle::createCFURLConnection):
1425         (WebCore::ResourceHandle::start):
1426         (WebCore::ResourceHandle::willSendRequest):
1427         (WebCore::ResourceHandle::shouldUseCredentialStorage):
1428         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1429         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1430         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1431         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
1432         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle):
1433         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1434         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1435         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
1436         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
1437         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
1438         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1439         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
1440         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
1441         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
1442         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1443         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
1444         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1445         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed.
1446         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed.
1447         * platform/network/mac/ResourceHandleMac.mm:
1448         (WebCore::ResourceHandle::start):
1449         (WebCore::ResourceHandle::schedule):
1450         (WebCore::ResourceHandle::makeDelegate):
1451         (WebCore::ResourceHandle::delegate):
1452         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1453         (WebCore::ResourceHandle::willSendRequest):
1454         (WebCore::ResourceHandle::continueWillSendRequest):
1455         (WebCore::ResourceHandle::continueDidReceiveResponse):
1456         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1457         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
1458         (WebCore::ResourceHandle::continueWillCacheResponse):
1459         (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted.
1460         * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed.
1461         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed.
1462         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1463         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1464         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1465         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
1466         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1467         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1468         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
1469         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
1470         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
1471         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1472
1473 2017-10-12  Chris Dumez  <cdumez@apple.com>
1474
1475         [Mac] Add support for MouseEvent.buttons
1476         https://bugs.webkit.org/show_bug.cgi?id=178214
1477
1478         Reviewed by Ryosuke Niwa.
1479
1480         Add support for MouseEvent.buttons on Mac as per:
1481         - https://www.w3.org/TR/uievents/#ref-for-dom-mouseevent-buttons-1
1482
1483         This is supported by Firefox and Chrome already.
1484
1485         No new tests, rebaselined existing test.
1486
1487         * dom/Element.cpp:
1488         (WebCore::Element::dispatchMouseEvent):
1489         * dom/MouseEvent.cpp:
1490         (WebCore::MouseEvent::create):
1491         (WebCore::MouseEvent::MouseEvent):
1492         * dom/MouseEvent.h:
1493         (WebCore::MouseEvent::buttons const):
1494         * dom/MouseEvent.idl:
1495         * dom/MouseEventInit.h:
1496         * dom/MouseEventInit.idl:
1497         * dom/SimulatedClick.cpp:
1498         * dom/WheelEvent.cpp:
1499         * page/EventHandler.cpp:
1500         (WebCore::EventHandler::dispatchDragEvent):
1501         * platform/PlatformMouseEvent.h:
1502         (WebCore::PlatformMouseEvent::buttons const):
1503         * platform/mac/PlatformEventFactoryMac.mm:
1504         (WebCore::currentlyPressedMouseButtons):
1505         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
1506
1507 2017-10-12  David Kilzer  <ddkilzer@apple.com>
1508
1509         [iOS] Fix -Wunused-lambda-capture warnings in WebCore/WebKit with new clang compiler
1510         <https://webkit.org/b/178226>
1511
1512         Reviewed by Chris Fleizach.
1513
1514         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1515         (-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
1516         - Remove unused lambda variable 'self'.
1517
1518 2017-10-12  Daniel Bates  <dabates@apple.com>
1519
1520         Mark more InlineBox member functions as const
1521         https://bugs.webkit.org/show_bug.cgi?id=178217
1522
1523         Reviewed by Andy Estes.
1524
1525         * rendering/InlineBox.cpp:
1526         (WebCore::InlineBox::locationIncludingFlipping const): Mark as const. Also fix some style
1527         nits while I am here.
1528         (WebCore::InlineBox::flipForWritingMode const): Mark as const.
1529         (WebCore::InlineBox::locationIncludingFlipping): Deleted.
1530         (WebCore::InlineBox::flipForWritingMode): Deleted.
1531         * rendering/InlineBox.h:
1532
1533 2017-10-12  Daniel Bates  <dabates@apple.com>
1534
1535         Teach InlineTextBox::clampOffset() about combined text and hyphenation
1536         https://bugs.webkit.org/show_bug.cgi?id=178032
1537
1538         Reviewed by Zalan Bujtas.
1539
1540         Treat combined text and the last character of a word halve plus hyphen as single units.
1541
1542         With regards to combined text, ideally we would allow arbitrary selection inside combined
1543         text. Currently we do not support selection of combined text. To simplify the process of
1544         adding support for selecting combined text we treat combined text as a single unit. Once
1545         we are confident that we correctly implemented such support we can re-evaluate allowing
1546         arbitrary selection of combined text.
1547
1548         With regards to treating the last character of a word halve plus hyphen as a single unit.
1549         This patch extends the targeted fix made for document markers in r223013 to all code that
1550         makes use of clamped offsets as a result the selection rect for inline boxes more accurately
1551         reflect the rectangle(s) that make up the painted selection. This is a step towards reconciling
1552         the difference between the computation of the rectangle that represents an arbitrary
1553         selection and the code that paints the active selection as part of <https://bugs.webkit.org/show_bug.cgi?id=138913>.
1554
1555         * rendering/InlineTextBox.cpp:
1556         (WebCore::InlineTextBox::localSelectionRect const): Compute text run, including combined text
1557         or hyphens due to line wrapping now that specified start and end positions are clamped with
1558         respect to combined text and hyphens (computed earlier in this function). Only measure the
1559         text represented by the selection if the start position > 0 or the end position is not equal
1560         to the length of the run.
1561         (WebCore::InlineTextBox::paint): Remove unnecessary code to fix up the selection start and
1562         end positions based on the truncation offset as this is done by clampedOffset(), called by
1563         selectionStartEnd().
1564         (WebCore::InlineTextBox::clampedOffset const): Modified to adjust the clamped offset with
1565         respect to truncation as well as treat combined text or a trailing word halve plus hyphen
1566         as single units. Assert that we are not fully truncated because it does not make sense to
1567         be computing the clamped offset in such a situation since nothing should be painted.
1568         (WebCore::InlineTextBox::selectionStartEnd const): Modified to compute the end of an inside
1569         selection using clampedOffset() to account for truncation, combined text or a hyphen. We
1570         already are using clampedOffset() when computing the start and end position for all other
1571         selection states.
1572         (WebCore::InlineTextBox::paintSelection): Compute text run, including combined text
1573         or hyphens due to line wrapping now that specified start and end positions are clamped with
1574         respect to combined text and hyphens (computed earlier in this function). Remove unnecessary
1575         code to adjust selection end point with respect to truncation, combined text, or an added
1576         hyphen now that selectionStartEnd() takes care of this (via clampedOffset()).
1577         (WebCore::InlineTextBox::paintTextSubrangeBackground): Compute text run, including combined
1578         text or hyphens due to line wrapping now that specified start and end positions are clamped
1579         with respect to combined text and hyphens (computed earlier in this function).
1580         (WebCore::InlineTextBox::paintDocumentMarker): Compute text run, including combined text now
1581         that specified start and end positions are clamped with respect to combined text (computed earlier in this function).
1582         Also remove unnecessary code to adjust end offset of the marker with respect to truncation
1583         and length of the text run as clampedOffset() now does this for us.
1584
1585 2017-10-11  Simon Fraser  <simon.fraser@apple.com>
1586
1587         Don't assert if mix-blend-mode is set to a non-separable blend mode on a composited layer
1588         https://bugs.webkit.org/show_bug.cgi?id=178196
1589         rdar://problem/34942337
1590
1591         Reviewed by Dan Bates.
1592
1593         Core Animation doesn't support non-separable blend modes (hue, saturation, color, luminosity)
1594         on layers, but don't assert if we try to use them.
1595
1596         Test: compositing/filters/blend-mode-saturation.html
1597
1598         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
1599         (PlatformCAFilters::setBlendingFiltersOnLayer):
1600
1601 2017-10-12  John Wilander  <wilander@apple.com>
1602
1603         ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url()
1604         https://bugs.webkit.org/show_bug.cgi?id=175257
1605         <rdar://problem/33359866>
1606
1607         Reviewed by Brent Fulgham.
1608
1609         This patch was joint work between Michael Specter and John Wilander.
1610
1611         Tests: http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1612                http/tests/resourceLoadStatistics/non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1613                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1614                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1615                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1616                http/tests/resourceLoadStatistics/non-sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1617                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1618                http/tests/resourceLoadStatistics/sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1619                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1620                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1621                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1622                http/tests/resourceLoadStatistics/sandboxed-nesting-iframe-with-sandboxed-iframe-redirect-localhost-to-ip-to-localhost.html
1623
1624         * loader/DocumentLoader.cpp:
1625         (WebCore::DocumentLoader::willSendRequest):
1626             Now sends redirectResponse.url() to WebCore::ResourceLoadObserver::logFrameNavigation().
1627         * loader/ResourceLoadObserver.cpp:
1628         (WebCore::ResourceLoadObserver::logFrameNavigation):
1629             Now receives the redirect response URL from WebCore::DocumentLoader().
1630         (WebCore::ResourceLoadObserver::nonNullOwnerURL const):
1631             New function to traverse the frame chain upward and find the first non-null URL.
1632         * loader/ResourceLoadObserver.h:
1633
1634 2017-10-12  Frederic Wang  <fwang@igalia.com>
1635
1636         Use less specific cast in ScrollingTree::scrollPositionChangedViaDelegatedScrolling
1637         https://bugs.webkit.org/show_bug.cgi?id=178211
1638
1639         Reviewed by Simon Fraser.
1640
1641         No new tests, behavior is not changed.
1642
1643         ScrollingTree::scrollPositionChangedViaDelegatedScrolling is a generic function that applies
1644         to scrolling nodes. Casting to more specific ScrollingTreeOverflowScrollingNodes is however
1645         not necessary to implement it. This patch moves to the least specific cast necessary so that
1646         this function will be usable for async scrolling of non-main frames in the future. Note that
1647         the function is currently only called from ScrollingTreeScrollingNodeDelegateIOS which in
1648         turn is only used by the ScrollingTreeScrollingOverflowNodeIOS class and so code behavior is
1649         not changed.
1650
1651         * page/scrolling/ScrollingTree.cpp:
1652         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Only cast the node to
1653         ScrollingTreeScrollingNode.
1654
1655 2017-10-11  Sam Weinig  <sam@webkit.org>
1656
1657         Remove out-parameter variants of copyToVector
1658         https://bugs.webkit.org/show_bug.cgi?id=178155
1659
1660         Reviewed by Tim Horton.
1661
1662         * Modules/geolocation/Geolocation.cpp:
1663         (WebCore::Geolocation::stopTimersForOneShots):
1664         (WebCore::Geolocation::cancelAllRequests):
1665         (WebCore::Geolocation::handleError):
1666         (WebCore::Geolocation::makeSuccessCallbacks):
1667         * Modules/indexeddb/IDBDatabase.cpp:
1668         (WebCore::IDBDatabase::transaction):
1669         * Modules/indexeddb/IDBGetAllResult.cpp:
1670         (WebCore::IDBGetAllResult::allBlobFilePaths const):
1671         * Modules/indexeddb/server/MemoryIndex.cpp:
1672         (WebCore::IDBServer::MemoryIndex::notifyCursorsOfValueChange):
1673         (WebCore::IDBServer::MemoryIndex::notifyCursorsOfAllRecordsChanged):
1674         * css/CSSFontSelector.cpp:
1675         (WebCore::CSSFontSelector::dispatchInvalidationCallbacks):
1676         * dom/Document.cpp:
1677         (WebCore::Document::moveNodeIteratorsToNewDocument):
1678         (WebCore::Document::resume):
1679         (WebCore::Document::didAssociateFormControlsTimerFired):
1680         * dom/IdTargetObserverRegistry.cpp:
1681         (WebCore::IdTargetObserverRegistry::notifyObserversInternal):
1682         * dom/MutationObserver.cpp:
1683         (WebCore::MutationObserver::notifyMutationObservers):
1684         * dom/Node.cpp:
1685         (WebCore::Document::invalidateNodeListAndCollectionCaches):
1686         * dom/RadioButtonGroups.cpp:
1687         * dom/ScriptExecutionContext.cpp:
1688         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
1689         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
1690         * loader/appcache/ApplicationCacheGroup.cpp:
1691         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
1692         (WebCore::ApplicationCacheGroup::deliverDelayedMainResources):
1693         * loader/cache/MemoryCache.cpp:
1694         (WebCore::MemoryCache::forEachResource):
1695         (WebCore::MemoryCache::pruneDeadResourcesToSize):
1696         * page/DOMWindow.cpp:
1697         (WebCore::DOMWindow::willDestroyCachedFrame):
1698         (WebCore::DOMWindow::willDestroyDocumentInFrame):
1699         (WebCore::DOMWindow::willDetachDocumentFromFrame):
1700         (WebCore::DOMWindow::disconnectDOMWindowProperties):
1701         (WebCore::DOMWindow::reconnectDOMWindowProperties):
1702         * page/FrameView.cpp:
1703         (WebCore::collectAndProtectWidgets):
1704         * page/MemoryRelease.cpp:
1705         (WebCore::releaseCriticalMemory):
1706         * page/Performance.cpp:
1707         (WebCore::Performance::queueEntry):
1708         * platform/cocoa/PasteboardCocoa.mm:
1709         (WebCore::Pasteboard::typesForLegacyUnsafeBindings):
1710         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1711         (WebCore::FontCache::systemFontFamilies):
1712         * platform/ios/PlatformPasteboardIOS.mm:
1713         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
1714         * platform/ios/WebCoreMotionManager.mm:
1715         (-[WebCoreMotionManager sendAccelerometerData:]):
1716         (-[WebCoreMotionManager sendMotionData:withHeading:]):
1717         * platform/mac/PlatformPasteboardMac.mm:
1718         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
1719         * platform/network/cocoa/WebCoreNSURLSession.mm:
1720         (-[WebCoreNSURLSession invalidateAndCancel]):
1721         * rendering/RenderBlock.cpp:
1722         (WebCore::RenderBlock::endAndCommitUpdateScrollInfoAfterLayoutTransaction):
1723         * rendering/RenderBlockLineLayout.cpp:
1724         (WebCore::setLogicalWidthForTextRun):
1725         * rendering/RenderDeprecatedFlexibleBox.cpp:
1726         (WebCore::FlexBoxIterator::next):
1727         * rendering/RenderTableSection.cpp:
1728         (WebCore::RenderTableSection::paintObject):
1729
1730             Replace out-parameter based copyToVector, with one that returns a Vector.
1731
1732 2017-10-12  Yusuke Suzuki  <utatane.tea@gmail.com>
1733
1734         Support integrity="" on module scripts
1735         https://bugs.webkit.org/show_bug.cgi?id=177959
1736
1737         Reviewed by Sam Weinig.
1738
1739         This patch extends module hooks to accept fetching parameters.
1740         When starting fetching modules, WebCore creates ModuleFetchParameters.
1741         And this parameters is propagated to the fetch hook. Then, fetch
1742         hook can use this parameters to fetch modules.
1743
1744         This parameters only contains `integrity` field. This "integrity" is
1745         used to perform subresource integrity check in module loader pipeline.
1746         And this error is just proparaged as errors in module pipeline, which
1747         is the same to the other types of errors in module pipeline.
1748
1749         Test: http/tests/subresource-integrity/sri-module.html
1750
1751         * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Added.
1752         * ForwardingHeaders/runtime/ScriptFetchParameters.h: Added.
1753         * WebCore.xcodeproj/project.pbxproj:
1754         * bindings/js/CachedModuleScriptLoader.cpp:
1755         (WebCore::CachedModuleScriptLoader::create):
1756         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
1757         Take parameters, which includes "integrity".
1758
1759         * bindings/js/CachedModuleScriptLoader.h:
1760         * bindings/js/JSDOMWindowBase.cpp:
1761         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
1762         (WebCore::JSDOMWindowBase::moduleLoaderImportModule):
1763         import and fetch hooks take parameters.
1764
1765         * bindings/js/JSDOMWindowBase.h:
1766         * bindings/js/JSMainThreadExecState.h:
1767         (WebCore::JSMainThreadExecState::loadModule):
1768         * bindings/js/ScriptController.cpp:
1769         (WebCore::ScriptController::loadModuleScriptInWorld):
1770         (WebCore::ScriptController::loadModuleScript):
1771         Pass parameters to the entry point of the module pipeline.
1772
1773         * bindings/js/ScriptController.h:
1774         * bindings/js/ScriptModuleLoader.cpp:
1775         (WebCore::ScriptModuleLoader::fetch):
1776         If parameters are passed, we set them to CachedModuleScriptLoader.
1777
1778         (WebCore::ScriptModuleLoader::importModule):
1779         Pass parameters to the entry point of dynamic import.
1780
1781         (WebCore::ScriptModuleLoader::notifyFinished):
1782         If script loader has parameters, we perform subresource integrity check here.
1783
1784         * bindings/js/ScriptModuleLoader.h:
1785         * dom/LoadableModuleScript.cpp:
1786         (WebCore::LoadableModuleScript::create):
1787         (WebCore::LoadableModuleScript::LoadableModuleScript):
1788         (WebCore::LoadableModuleScript::load):
1789         Create ModuleFetchParameters with "integrity" value.
1790
1791         * dom/LoadableModuleScript.h:
1792         * dom/ModuleFetchParameters.h: Copied from Source/WebCore/bindings/js/CachedModuleScriptLoader.h.
1793         (WebCore::ModuleFetchParameters::create):
1794         (WebCore::ModuleFetchParameters::integrity const):
1795         (WebCore::ModuleFetchParameters::ModuleFetchParameters):
1796         * dom/ScriptElement.cpp:
1797         (WebCore::ScriptElement::requestModuleScript):
1798         Pass "integrity" value to the module script.
1799
1800 2017-10-12  Tomas Popela  <tpopela@redhat.com>
1801
1802         Unreviewed, fix compilation warning
1803
1804         warning: extra tokens at end of #endif directive [-Wendif-labels]
1805
1806         * rendering/RenderMediaControls.h:
1807
1808 2017-10-11  Brent Fulgham  <bfulgham@apple.com>
1809
1810         Correct nullptr deref in selection handling.
1811         https://bugs.webkit.org/show_bug.cgi?id=178189
1812         <rdar://problem/33833012>
1813
1814         Reviewed by Ryosuke Niwa.
1815
1816         The VisibleSelection::toNormalizedRange returns nullptr for certain conditions (e.g., 'isNone'
1817         and 'isOrphaned' cases). It's possible to crash the WebProcess by executing a code path with
1818         an orphaned selection range.
1819
1820         The return value of 'toNormalizedRange' is checked for nullptr in many places, but not everywhere.
1821         This patch adds those missing nullptr checks.
1822
1823         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1824         (-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
1825         * editing/DeleteSelectionCommand.cpp:
1826         (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
1827         * editing/EditingStyle.cpp:
1828         (WebCore::EditingStyle::styleAtSelectionStart):
1829         * editing/Editor.cpp:
1830         (WebCore::Editor::misspelledWordAtCaretOrRange const):
1831         * page/DOMSelection.cpp:
1832         (WebCore::DOMSelection::containsNode const):
1833         * page/DragController.cpp:
1834         (WebCore::DragController::concludeEditDrag):
1835
1836 2017-10-11  Ryan Haddad  <ryanhaddad@apple.com>
1837
1838         Unreviewed, rolling out r223215.
1839
1840         This change broke the Sierra build.
1841
1842         Reverted changeset:
1843
1844         "[Apple Pay] Add subLocality and subAdministrativeArea to
1845         ApplePayPaymentContact"
1846         https://bugs.webkit.org/show_bug.cgi?id=178191
1847         https://trac.webkit.org/changeset/223215
1848
1849 2017-10-11  Chris Dumez  <cdumez@apple.com>
1850
1851         XMLHttpRequest: do not sniff text/html, and do not sniff XML when responseType is set to "text"
1852         https://bugs.webkit.org/show_bug.cgi?id=168724
1853
1854         Reviewed by Ryosuke Niwa.
1855
1856         WebKit enabled HTML / XML charset detection for HTML-ish / XML-ish
1857         responses even when response type is text, which does not match the
1858         specification.
1859
1860         This patch is based on the following Blink patch by Yutaka Hirano <yhirano@chromium.org>:
1861         - https://chromium.googlesource.com/chromium/src.git/+/47e4fc53e6d68c0a788fcc26de598b9e3848033f
1862
1863         Tests:
1864         imported/w3c/web-platform-tests/XMLHttpRequest/responsetext-decoding.htm
1865         imported/w3c/web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm
1866
1867         * xml/XMLHttpRequest.cpp:
1868         (WebCore::XMLHttpRequest::createDecoder const):
1869         (WebCore::XMLHttpRequest::didReceiveData):
1870         * xml/XMLHttpRequest.h:
1871
1872 2017-10-11  Andy Estes  <aestes@apple.com>
1873
1874         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact
1875         https://bugs.webkit.org/show_bug.cgi?id=178191
1876         <rdar://problem/34906367>
1877
1878         Reviewed by Tim Horton.
1879
1880         Added test cases to http/tests/ssl/applepay/ApplePaySession.html.
1881
1882         * Modules/applepay/ApplePayPaymentContact.h:
1883         * Modules/applepay/ApplePayPaymentContact.idl:
1884         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1885         (WebCore::convert):
1886
1887 2017-10-11  Youenn Fablet  <youenn@apple.com>
1888
1889         Add API to clean CacheStorage data
1890         https://bugs.webkit.org/show_bug.cgi?id=178034
1891
1892         Reviewed by Chris Dumez.
1893
1894         Test: http/tests/cache-storage/cache-clearing.https.html
1895
1896         * platform/FileSystem.h:
1897
1898 2017-10-11  David Kilzer  <ddkilzer@apple.com>
1899
1900         Part 2: Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
1901         <https://webkit.org/b/178036>
1902         <rdar://problem/33667497>
1903
1904         Reviewed by Chris Dumez.
1905
1906         * Modules/cache/WorkerCacheStorageConnection.cpp:
1907         (WebCore::WorkerCacheStorageConnection::doRemove):
1908         - Change ASSERT() to ASSERT_UNUSED() to suppress warnings about
1909           unused lambda capture for 'cacheIdentifier' in Release builds.
1910         * bridge/objc/objc_class.mm:
1911         (JSC::Bindings::ObjcClass::classForIsA): Change C-style cast
1912         into reinterpret_cast and const_cast to go from CFTypeRef to
1913         ObjcClass*.
1914         * crypto/mac/CryptoKeyRSAMac.cpp:
1915         (WebCore::castDataArgumentToCCRSACryptorCreateFromDataIfNeeded):
1916         Add.  Introduce method to add a required const_cast for older
1917         OSes since the signature of CCRSACryptorCreateFromData() changed
1918         in iOS 11 & High Sierra.
1919         (WebCore::CryptoKeyRSA::create): Use
1920         castDataArgumentToCCRSACryptorCreateFromDataIfNeeded().
1921         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1922         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
1923         Remove unused lambda capture for 'status'.
1924
1925 2017-10-11  Chris Dumez  <cdumez@apple.com>
1926
1927         [Geolocation] Expose Coordinates.floorLevel
1928         https://bugs.webkit.org/show_bug.cgi?id=178173
1929         <rdar://problem/34918936>
1930
1931         Reviewed by Ryosuke Niwa.
1932
1933         Expose Coordinates.floorLevel via the Geolocation API. This is currently
1934         a WebKit-specific extension and it is only populated on iOS / WKTR / DRT.
1935         It is null on other platforms.
1936
1937         Test: fast/dom/Geolocation/floorLevel.html
1938
1939         * Modules/geolocation/Coordinates.h:
1940         (WebCore::Coordinates::floorLevel const):
1941         * Modules/geolocation/Coordinates.idl:
1942         * Modules/geolocation/GeolocationPosition.h:
1943         (WebCore::GeolocationPosition::encode const):
1944         (WebCore::GeolocationPosition::decode):
1945         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
1946         (WebCore::GeolocationPosition::GeolocationPosition):
1947         * page/Settings.in:
1948
1949 2017-10-11  Simon Fraser  <simon.fraser@apple.com>
1950
1951         Avoid triggering layout from style change
1952         https://bugs.webkit.org/show_bug.cgi?id=178184
1953         rdar://problem/34699113
1954
1955         Reviewed by Zalan Bujtas.
1956
1957         It's bad for RenderBox::styleDidChange() to scroll RenderLayers, because that
1958         can trigger layout via FrameView::updateWidgetPositions() and ScrollingCoordinator::absoluteEventTrackingRegions().
1959         So postpone the scrolling until after layout.
1960
1961         Test: fast/scrolling/adjust-scroll-offset-on-zoom.html
1962
1963         * rendering/RenderBox.cpp:
1964         (WebCore::RenderBox::styleDidChange):
1965         * rendering/RenderLayer.cpp:
1966         (WebCore::RenderLayer::updateLayerPositions):
1967         (WebCore::RenderLayer::setPostLayoutScrollPosition):
1968         (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded):
1969         * rendering/RenderLayer.h:
1970
1971 2017-10-11  Youenn Fablet  <youenn@apple.com>
1972
1973         Bump default cache storage quota to 20MB
1974         https://bugs.webkit.org/show_bug.cgi?id=178132
1975
1976         Reviewed by Alex Christensen.
1977
1978         Covered by http/wpt/cache-storage/cache-quota.any.html.
1979
1980         * platform/network/NetworkStorageSession.h:
1981         (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const):
1982         (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota):
1983
1984 2017-10-11  Myles C. Maxfield  <mmaxfield@apple.com>
1985
1986         Allow PAL to log messages
1987         https://bugs.webkit.org/show_bug.cgi?id=171523
1988
1989         Reviewed by Alex Christensen.
1990
1991         Make the model of WebCore/PAL match the model of WebKit/WebCore. This is because PAL will
1992         need to log things (because existing files in WebCore/platform need to log things).
1993
1994         No new tests because there is no behavior change.
1995
1996         * WebCore.xcodeproj/project.pbxproj:
1997         * page/mac/PageMac.mm:
1998         (WebCore::Page::platformInitialize):
1999         * platform/Logging.cpp:
2000         (WebCore::registerNotifyCallback): Deleted.
2001         * platform/Logging.h:
2002         * rendering/SimpleLineLayout.cpp:
2003         (WebCore::SimpleLineLayout::canUseForWithReason):
2004
2005 2017-10-11  Chris Dumez  <cdumez@apple.com>
2006
2007         Unreviewed, fix build with some SDKs.
2008
2009         Stop capturing |this| unnecessarily in lambda.
2010
2011         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
2012         (WebCore::FileSystemDirectoryEntry::getEntry):
2013
2014 2017-10-11  Chris Dumez  <cdumez@apple.com>
2015
2016         Unreviewed, fix build with some SDKs.
2017
2018         Stop capturing |this| unnecessarily in lambda.
2019
2020         * Modules/entriesapi/DOMFileSystem.cpp:
2021         (WebCore::DOMFileSystem::getFile):
2022
2023 2017-10-11  Daniel Bates  <dabates@apple.com>
2024
2025         Extract logic to paint composition underlines to its own function
2026         https://bugs.webkit.org/show_bug.cgi?id=178038
2027
2028         Reviewed by Zalan Bujtas.
2029
2030         No functionality changed. So, no new tests.
2031
2032         * rendering/InlineTextBox.cpp:
2033         (WebCore::InlineTextBox::paint): Modified to call paintCompositionUnderlines().
2034         (WebCore::InlineTextBox::paintCompositionUnderlines const): Added; extract code
2035         from InlineTextBox::paint() and modernized it.
2036         (WebCore::InlineTextBox::paintCompositionUnderline const): Added.
2037         (WebCore::InlineTextBox::paintCompositionUnderline): Deleted; made const.
2038         * rendering/InlineTextBox.h:
2039
2040 2017-10-11  Daniel Bates  <dabates@apple.com>
2041
2042         InlineTextBox::isSelected() should only return true for a non-empty selection
2043         and remove incorrect FIXME from InlineTextBox::localSelectionRect()
2044         https://bugs.webkit.org/show_bug.cgi?id=160786
2045
2046         Reviewed by Zalan Bujtas.
2047
2048         Partial revert of r204400 in InlineTextBox::{isSelected, localSelectionRect}().
2049
2050         The function InlineTextBox::isSelected() should only return true for a non-empty selection.
2051         Also remove an incorrect FIXME added to InlineTextBox::localSelectionRect() that questioned
2052         whether it was correct for it to return an empty rectangle. It is correct for it to return
2053         such a rectangle because this function is used to implement Element.getClientRects(). And
2054         Element.getClientRects() can return a rectangle with zero width or zero height by step 3
2055         of algorithm getClientRects() of section Extensions to the Element interface of the
2056         CSSOM View Module spec., <https://drafts.csswg.org/cssom-view/> (Editor's Draft, 15 September 2017).
2057
2058         * rendering/InlineTextBox.cpp:
2059         (WebCore::InlineTextBox::isSelected const): Only return true for a non-empty selection
2060         and remove unnecessary FIXME. Also rename variables to improve readability.
2061         (WebCore::InlineTextBox::localSelectionRect const): Remove inaccurate FIXME comment.
2062         * rendering/InlineTextBox.h:
2063
2064 2017-10-11  Ryosuke Niwa  <rniwa@webkit.org>
2065
2066         Sanitize URL in pasteboard for other applications and cross origin content
2067         https://bugs.webkit.org/show_bug.cgi?id=178060
2068         <rdar://problem/34874518>
2069
2070         Reviewed by Wenson Hsieh.
2071
2072         This patch introduces the sanitization of URL when written from a web content to prevent web content from
2073         exploiting the URL parser of other applications in the system particularly of those that actively monitor
2074         system pasteboard (a.k.a. clipboard on non-Cocoa platforms) and decode or otherwise process URLs.
2075
2076         Because the Web compatibility requires that DataTransfer exposes the original URL to any document in the
2077         same origin as the one which wrote the URL into the pasteboard, we store a string which uniquely identifies
2078         the origin of an originating document into our custom pasteboard data. Note that we expose any URL which
2079         didn't come from WebKit since we don't expect URLs to reveal privacy sensitive information. We use UUID for
2080         the origin identifier of a null origin document.
2081
2082         An alternative approach is to store the pasteboard data from the same origin into the document and invalidate
2083         it when the system pasteboard changes. However, Pasteboard object cannot know about Document (as Pasteboard
2084         is a platform object and Document is a WebCore object), this turns out be quite tricky as there are multiple
2085         places where we create Pasteboard objects, and they all need to be aware of this special same origin
2086         Pasteboard object that hangs off of Document. Also, this approach would result in the same origin code paths
2087         to diverge between null origin and non-null origin documents.
2088
2089         Tests: editing/pasteboard/data-transfer-get-data-on-copying-pasting-malformed-url-in-same-document.html
2090                editing/pasteboard/data-transfer-set-data-ignore-copied-walformed-url-in-null-origin.html
2091                editing/pasteboard/data-transfer-set-data-sanitlize-url-when-copying-in-null-origin.html
2092                editing/pasteboard/data-transfer-set-data-sanitlize-url-when-dragging-in-null-origin.html
2093                http/tests/security/clipboard/copy-paste-url-across-origin-sanitizes-url.html
2094                CopyURL.ValidURL
2095                CopyURL.UnescapedURL
2096                CopyURL.MalformedURL
2097                DataInteractionTests.DataTransferSetDataValidURL
2098                DataInteractionTests.DataTransferSetDataUnescapedURL
2099                DataInteractionTests.DataTransferSetDataInvalidURL
2100
2101         * dom/DataTransfer.cpp:
2102         (WebCore::originForDocument): Extracted from createForCopyAndPaste.
2103         (WebCore::DataTransfer::createForCopyAndPaste):
2104         (WebCore::DataTransfer::getDataForItem const): Read the URL from the custom data when the originating content
2105         is of the same origin. When the originating content is cross origin, or there is no custom data (e.g. written
2106         by another native application; or sanitization didn't result in any difference), then callback to native value.
2107         (WebCore::DataTransfer::setDataFromItemList): Sanitize the URL before writing it to the native pasteboard.
2108         Store the original value if the sanitization resulted in any difference.
2109         (WebCore::DataTransfer::types const):
2110         (WebCore::DataTransfer::commitToPasteboard): Moved the code to write custom data to Pasteboard since we need
2111         to write the origin string with it.
2112         (WebCore::DataTransfer::createForDragStartEvent): Added Document as an argument to compute the origin string.
2113         (WebCore::DataTransfer::createForDrop): Ditto.
2114         (WebCore::DataTransfer::createForUpdatingDropTarget):
2115         (WebCore::DataTransfer::moveDragState):
2116         * dom/DataTransfer.h:
2117         * dom/Document.cpp:
2118         (WebCore::Document::uniqueIdentifier): Added. See above.
2119         * dom/Document.h:
2120         * editing/Editor.cpp:
2121         (WebCore::createDataTransferForClipboardEvent):
2122         (WebCore::dispatchClipboardEvent):
2123         * page/DragController.cpp:
2124         (WebCore::DragController::dispatchTextInputEventFor):
2125         * page/EventHandler.cpp:
2126         (WebCore::EventHandler::performDragAndDrop):
2127         (WebCore::EventHandler::handleDrag):
2128         * platform/Pasteboard.h:
2129         * platform/PasteboardStrategy.h:
2130         * platform/PlatformPasteboard.h:
2131         * platform/StaticPasteboard.cpp:
2132         (WebCore::StaticPasteboard::takeCustomData): Moved the logic to write to native pasteboard to DataTransfer.
2133         * platform/StaticPasteboard.h:
2134         * platform/cocoa/PasteboardCocoa.mm:
2135         (WebCore::Pasteboard::typesSafeForBindings):
2136         (WebCore::Pasteboard::readStringInCustomData): Rewritten using readCustomData. See below.
2137         (WebCore::Pasteboard::readOrigin): Added.
2138         (WebCore::Pasteboard::readCustomData): Added. Populates the cache. Because a single Pasteboard object is never
2139         allowed to read values once its content is updated by other applications, we can permanently cache the result.
2140         * platform/gtk/PasteboardGtk.cpp:
2141         (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string.
2142         (WebCore::Pasteboard::readOrigin): Added.
2143         * platform/gtk/PlatformPasteboardGtk.cpp:
2144         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Now takes the unused origin string.
2145         * platform/ios/PlatformPasteboardIOS.mm:
2146         (WebCore::originKeyKeyForTeamData): Added.
2147         (WebCore::customTypesKeyForTeamData): Added. Replaces the use of PasteboardCustomData::cocoaType() in the team
2148         data for clarity since the team data key isn't same as the pasteboard type. We don't have to worry about the
2149         backwards compatibility since drag & drop session doesn't persist across iOS upgrades, and there is no publicly
2150         released iOS with this team data support.
2151         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Read the origin string and the custom data
2152         off the team data. Don't expose custom types that are written by cross origin documents.
2153         (WebCore::PlatformPasteboard::write): Add the orign string with custom pasteboard types in the team data.
2154         (WebCore::PlatformPasteboard::readURL): Fixed a bug that this function was not reading NSURL when UIPasteboard
2155         serializes NSURL as a plist. This code is exercised by CopyURL.ValidURL.
2156         * platform/mac/PlatformPasteboardMac.mm:
2157         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Don't add custom pasteboard types that are
2158         added by cross origin documents.
2159         * platform/win/PasteboardWin.cpp:
2160         (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string.
2161         (WebCore::Pasteboard::readOrigin): Added.
2162         * platform/wpe/PasteboardWPE.cpp:
2163         (WebCore::Pasteboard::typesSafeForBindings): Now takes the unused origin string.
2164         (WebCore::Pasteboard::readOrigin): Added.
2165         * platform/wpe/PlatformPasteboardWPE.cpp:
2166         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Now takes the unused origin string.
2167
2168 2017-10-11  Antti Koivisto  <antti@apple.com>
2169
2170         Remove some obsolete layout assertions
2171         https://bugs.webkit.org/show_bug.cgi?id=178170
2172
2173         Reviewed by Zalan Bujtas.
2174
2175         We have strong assertions against render tree mutation functions being called in layout. These are unnecessary.
2176
2177         * rendering/RenderBoxModelObject.cpp:
2178         (WebCore::RenderBoxModelObject::moveChildTo):
2179         * rendering/RenderElement.cpp:
2180         (WebCore::RenderElement::takeChildInternal):
2181         * rendering/RenderElement.h:
2182         * rendering/RenderListItem.cpp:
2183         (WebCore::RenderListItem::layout):
2184         * rendering/RenderListItem.h:
2185
2186 2017-10-11  Andy Estes  <aestes@apple.com>
2187
2188         [Payment Request] Implement Apple Pay merchant validation
2189         https://bugs.webkit.org/show_bug.cgi?id=178159
2190
2191         Reviewed by Brady Eidson.
2192
2193         When ApplePayPaymentHandler::validateMerchant() is called, dispatch the
2194         applepayvalidatemerchant event to the PaymentRequest object.
2195
2196         The event object is an ApplePayMerchantValidationEvent, on which the client calls complete()
2197         with a merchant session.
2198
2199         Test: http/tests/ssl/applepay/ApplePayMerchantValidationEvent.https.html
2200
2201         * DerivedSources.make:
2202         * Modules/applepay/ApplePayValidateMerchantEvent.h:
2203         * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp: Added.
2204         (WebCore::ApplePayMerchantValidationEvent::create):
2205         (WebCore::ApplePayMerchantValidationEvent::ApplePayMerchantValidationEvent):
2206         (WebCore::ApplePayMerchantValidationEvent::complete):
2207         (WebCore::ApplePayMerchantValidationEvent::eventInterface const):
2208         * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h: Added.
2209         * Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl: Added.
2210         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2211         (WebCore::ApplePayPaymentHandler::validateMerchant):
2212         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
2213         * Modules/paymentrequest/PaymentRequest.idl:
2214         * WebCore.xcodeproj/project.pbxproj:
2215         * dom/EventNames.h:
2216         * dom/EventNames.in:
2217         * testing/Internals.cpp:
2218         (WebCore::Internals::Internals):
2219         * testing/MockPaymentCoordinator.cpp:
2220         (WebCore::MockPaymentCoordinator::MockPaymentCoordinator):
2221         (WebCore::MockPaymentCoordinator::showPaymentUI):
2222         * testing/MockPaymentCoordinator.h:
2223
2224 2017-10-11  Chris Dumez  <cdumez@apple.com>
2225
2226         Modernize Geolocation code
2227         https://bugs.webkit.org/show_bug.cgi?id=178148
2228
2229         Reviewed by Ryosuke Niwa.
2230
2231         Modernize Geolocation code:
2232         - Use std::optional<> instead of separate boolean members
2233         - Make GeolocationPosition a simple struct that can be passed via IPC
2234         - Replace WebGeolocationPosition::Data with GeolocationPosition
2235         - Move logic to construct a GeolocationPosition from a CLLocation on iOS
2236           in one place to avoid code duplication.
2237
2238         * Modules/geolocation/Coordinates.cpp:
2239         (WebCore::Coordinates::Coordinates):
2240         * Modules/geolocation/Coordinates.h:
2241         (WebCore::Coordinates::create):
2242         (WebCore::Coordinates::isolatedCopy const):
2243         (WebCore::Coordinates::latitude const):
2244         (WebCore::Coordinates::longitude const):
2245         (WebCore::Coordinates::altitude const):
2246         (WebCore::Coordinates::accuracy const):
2247         (WebCore::Coordinates::altitudeAccuracy const):
2248         (WebCore::Coordinates::heading const):
2249         (WebCore::Coordinates::speed const):
2250         * Modules/geolocation/Geolocation.cpp:
2251         (WebCore::createGeoposition):
2252         (WebCore::Geolocation::lastPosition):
2253         * Modules/geolocation/GeolocationClient.h:
2254         * Modules/geolocation/GeolocationController.cpp:
2255         (WebCore::GeolocationController::positionChanged):
2256         (WebCore::GeolocationController::lastPosition):
2257         * Modules/geolocation/GeolocationController.h:
2258         * Modules/geolocation/GeolocationPosition.h:
2259         (WebCore::GeolocationPosition::GeolocationPosition):
2260         The default constructor is only needed by our IPC decoding code.
2261
2262         (WebCore::GeolocationPosition::encode const):
2263         (WebCore::GeolocationPosition::decode):
2264         * Modules/geolocation/ios/GeolocationPositionIOS.mm: Copied from Source/WebCore/Modules/geolocation/Coordinates.cpp.
2265         (WebCore::GeolocationPosition::GeolocationPosition):
2266         * WebCore.xcodeproj/project.pbxproj:
2267         * platform/mock/GeolocationClientMock.cpp:
2268         (WebCore::GeolocationClientMock::lastPosition):
2269         (WebCore::GeolocationClientMock::controllerTimerFired):
2270         * platform/mock/GeolocationClientMock.h:
2271
2272 2017-10-11  Brady Eidson  <beidson@apple.com>
2273
2274         Add a SW context process (where SW scripts will actually execute).
2275         https://bugs.webkit.org/show_bug.cgi?id=178156
2276         
2277         Reviewed by Andy Estes.
2278
2279         No new tests (Covered by changes to existing tests).
2280
2281         This patch adds an auxiliary "ServiceWorker context" WebProcess to a WebProcessPool.
2282
2283         This process is where ServiceWorker scripts will execute, separate from the client WebProcess
2284         hosting the page(s) they are serving.
2285
2286         This patch also adds all of the plumbing to pass along a fetched service worker script to this
2287         context WebProcess, as well as message back failure to actually start the script so we can test.
2288
2289         Touches lots of code sites but is basically just a lot of plumbing.
2290
2291         * WebCore.xcodeproj/project.pbxproj:
2292
2293         * workers/service/ServiceWorkerContextData.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.h.
2294         (WebCore::ServiceWorkerContextData::encode const):
2295         (WebCore::ServiceWorkerContextData::decode):
2296
2297         * workers/service/server/SWServer.cpp:
2298         (WebCore::SWServer::Connection::finishFetchingScriptInServer):
2299         (WebCore::SWServer::Connection::scriptContextFailedToStart):
2300         (WebCore::SWServer::scriptFetchFinished):
2301         (WebCore::SWServer::scriptContextFailedToStart):
2302         (WebCore::SWServer::createWorker):
2303         * workers/service/server/SWServer.h:
2304
2305         * workers/service/server/SWServerRegistration.cpp:
2306         (WebCore::SWServerRegistration::scriptFetchFinished):
2307         (WebCore::SWServerRegistration::scriptContextFailedToStart):
2308         * workers/service/server/SWServerRegistration.h:
2309
2310         * workers/service/server/SWServerWorker.cpp:
2311         (WebCore::SWServerWorker::SWServerWorker):
2312         (WebCore::SWServerWorker::~SWServerWorker):
2313         * workers/service/server/SWServerWorker.h:
2314         (WebCore::SWServerWorker::create):
2315         (WebCore::SWServerWorker::scriptURL const):
2316         (WebCore::SWServerWorker::script const):
2317         (WebCore::SWServerWorker::type const):
2318         (WebCore::SWServerWorker::workerID const):
2319
2320 2017-10-11  Joanmarie Diggs  <jdiggs@igalia.com>
2321
2322         [ATK] Expose value of aria-keyshortcuts as object attribute
2323         https://bugs.webkit.org/show_bug.cgi?id=171175
2324
2325         Reviewed by Chris Fleizach.
2326
2327         Expose the author-provided string through the "keyshortcuts" object attribute.
2328
2329         Test: accessibility/gtk/aria-keyshortcuts.html
2330
2331         * accessibility/AccessibilityObject.cpp:
2332         (WebCore::AccessibilityObject::ariaKeyShortcutsValue const):
2333         * accessibility/AccessibilityObject.h:
2334         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2335         (webkitAccessibleGetAttributes):
2336         * html/HTMLAttributeNames.in:
2337
2338 2017-10-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2339
2340         [JSC] Drop Instantiate hook in ES6 module loader
2341         https://bugs.webkit.org/show_bug.cgi?id=178162
2342
2343         Reviewed by Sam Weinig.
2344
2345         Drop instantiate hooks.
2346         No behavior change.
2347
2348         * bindings/js/JSDOMWindowBase.cpp:
2349         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2350
2351 2017-10-11  Alicia Boya García  <aboya@igalia.com>
2352
2353         [MSE][GStreamer] Add dump of append pipeline
2354         https://bugs.webkit.org/show_bug.cgi?id=178074
2355
2356         Reviewed by Xabier Rodriguez-Calvar.
2357
2358         Enable dump of AppendPipeline.
2359
2360         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2361         (WebCore::appendPipelineStateChangeMessageCallback):
2362         (WebCore::AppendPipeline::AppendPipeline):
2363         (WebCore::AppendPipeline::handleStateChangeMessage):
2364         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2365
2366 2017-09-27  Frederic Wang  <fwang@igalia.com>
2367
2368         [iOS] Do not flatten frames when async frame scrolling is enabled
2369         https://bugs.webkit.org/show_bug.cgi?id=173704
2370
2371         Reviewed by Simon Fraser.
2372
2373         This patch disables frame flattening when async frame scrolling is enabled on iOS, as
2374         otherwise you can not scroll them. Once iframe scrolling is implemented in iOS (bug 149264),
2375         developers and beta testers will be able to check it by enabling "Async Frame Scrolling"
2376         in the "Experimental WebKit Features" menu of Safari iOS.
2377
2378         Test: platform/ios/fast/frames/flattening/iframe-flattening-with-async-frame-scrolling.html
2379
2380         * page/FrameView.cpp:
2381         (WebCore::FrameView::frameFlatteningEnabled): Use effectiveFrameFlattening()
2382         * page/Settings.cpp:
2383         (WebCore::Settings::effectiveFrameFlattening): New function to return frameFlattening() or do
2384         some exceptions on iOS.
2385         * page/Settings.h: Declare effectiveFrameFlattening.
2386         * rendering/RenderFrameSet.cpp:
2387         (WebCore::RenderFrameSet::flattenFrameSet): Use effectiveFrameFlattening()
2388         * rendering/RenderIFrame.cpp:
2389         (WebCore::RenderIFrame::flattenFrame): Ditto.
2390         * rendering/RenderView.cpp:
2391         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Ditto.
2392
2393 2017-10-10  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2394
2395         [GStreamer] Fix double seek requested by downloadbuffer GStreamer element in webkibwebsrc
2396         https://bugs.webkit.org/show_bug.cgi?id=178079
2397
2398         Reviewed by Žan Doberšek.
2399
2400         When the downloadbuffer GStreamer element requests two seeks too
2401         close to each other there's some rare race condition where our
2402         source answers that it is not seekable and ends up with
2403         downloadbuffer element to seek beyond the file size, which causes
2404         the server to issue a 416 HTTP error code eventually, causing our
2405         MediaPlayer to stop.
2406
2407         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2408         (webKitWebSrcStop): We only unset he seekable attribute if we are
2409         not seeking.
2410
2411 2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
2412
2413         Enable custom pasteboard data in DumpRenderTree and WebKitTestRunner
2414         https://bugs.webkit.org/show_bug.cgi?id=178154
2415
2416         Reviewed by Wenson Hsieh.
2417
2418         Extracted the logic to compute the default enabled-ness of custom pasteboard data as
2419         Settings::defaultCustomPasteboardDataEnabled() to be called by WebKit1 and WebKit2 layers.
2420
2421         * page/Settings.cpp:
2422         (WebCore::Settings::defaultCustomPasteboardDataEnabled): Extracted from customPasteboardDataEnabled.
2423         (WebCore::Settings::customPasteboardDataEnabled): Deleted. Now inlined in the header file.
2424         * page/Settings.h:
2425         (WebCore::Settings::customPasteboardDataEnabled):
2426         * platform/cocoa/PasteboardCocoa.mm:
2427         (WebCore::Pasteboard::read): Fixed a bug that we were adding MIME type to the map before checking that
2428         we could actually read the buffer. We shouldn't skip a type (NSTIFFPboardType and kUTTypeTIFF for now)
2429         if an equivalent type had failed to read.
2430
2431 2017-10-10  Andy Estes  <aestes@apple.com>
2432
2433         [Payment Request] Validate that all PaymentCurrencyAmounts use the same currency code when using Apple Pay
2434         https://bugs.webkit.org/show_bug.cgi?id=178150
2435
2436         Reviewed by Tim Horton.
2437
2438         Apple Pay requires a single currency code, but the Payment Request API allows the client to
2439         specify a currency code for each PaymentCurrencyAmount.
2440
2441         Instead of having a required currencyCode property on ApplePayRequest and ignoring the
2442         currency property on PaymentCurrencyAmount, validate that all PaymentCurrencyAmounts use the
2443         same currency code and use that as ApplePaySessionPaymentRequest's currencyCode.
2444
2445         Added test cases to http/tests/ssl/applepay/PaymentRequest.https.html.
2446
2447         * Modules/applepay/ApplePayPaymentRequest.h:
2448         * Modules/applepay/ApplePayPaymentRequest.idl:
2449         * Modules/applepay/ApplePayRequestBase.cpp:
2450         (WebCore::convertAndValidate):
2451         * Modules/applepay/ApplePayRequestBase.h:
2452         * Modules/applepay/ApplePayRequestBase.idl:
2453         * Modules/applepay/ApplePaySession.cpp:
2454         (WebCore::convertAndValidate):
2455         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2456         (WebCore::validate):
2457         (WebCore::convertAndValidate):
2458         (WebCore::ApplePayPaymentHandler::show):
2459         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
2460
2461 2017-10-10  Andy Estes  <aestes@apple.com>
2462
2463         [Payment Request] Implement PaymentRequest.canMakePayment()
2464         https://bugs.webkit.org/show_bug.cgi?id=178048
2465
2466         Reviewed by Youenn Fablet.
2467
2468         Test: http/tests/paymentrequest/payment-request-canmakepayment-method.https.html
2469
2470         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2471         (WebCore::ApplePayPaymentHandler::convertData): Moved
2472         ApplePayRequest-to-ApplePaySessionPaymentRequest conversion from here to show().
2473         (WebCore::ApplePayPaymentHandler::show): Returned an exception if
2474         ApplePaySessionPaymentRequest conversion fails.
2475         (WebCore::shouldDiscloseApplePayCapability): Checked if we are in an ephimeral session or if
2476         Settings::applePayCapabilityDisclosureAllowed() is false.
2477         (WebCore::ApplePayPaymentHandler::canMakePayment): Called
2478         PaymentCoordinator::canMakePayments() or PaymentCoordinator::canMakePaymentsWithActiveCard()
2479         depending on shouldDiscloseApplePayCapability().
2480         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
2481         * Modules/applepay/paymentrequest/ApplePayRequest.h:
2482         * Modules/applepay/paymentrequest/ApplePayRequest.idl: Defined merchantIdentifier.
2483         * Modules/paymentrequest/PaymentHandler.h:
2484         * Modules/paymentrequest/PaymentRequest.cpp:
2485         (WebCore::parse): Moved JSON-parsing to here from show().
2486         (WebCore::PaymentRequest::show): Returned the exception from PaymentHandler::show().
2487         (WebCore::PaymentRequest::canMakePayment): For each payment method, try to create a
2488         PaymentHandler.
2489         For the first valid PaymentHandler, call canMakePayment() and pass a lambda that resolves
2490         the promise.
2491         * Modules/paymentrequest/PaymentRequest.h:
2492         * Modules/paymentrequest/PaymentRequest.idl: Added CallWith=Document annotations to show()
2493         and canMakePayment().
2494
2495 2017-10-10  Chris Dumez  <cdumez@apple.com>
2496
2497         Unreviewed, really fix the build with certain SDKs.
2498
2499         Follow-up to r223154, which fixed the wrong lambda.
2500
2501         * Modules/entriesapi/DOMFileSystem.cpp:
2502         (WebCore::DOMFileSystem::getEntry):
2503         (WebCore::DOMFileSystem::getFile):
2504
2505 2017-10-10  Chris Dumez  <cdumez@apple.com>
2506
2507         Unreviewed, fix build with certain SDKs.
2508
2509         Stop capturing |this| unnecessarily in lambda.
2510
2511         * Modules/entriesapi/DOMFileSystem.cpp:
2512         (WebCore::DOMFileSystem::getEntry):
2513
2514 2017-10-10  Matt Lewis  <jlewis3@apple.com>
2515
2516         Unreviewed, rolling out r223148.
2517
2518         This caused build failures.
2519
2520         Reverted changeset:
2521
2522         "Fix MSVC build with ENCRYPTED_MEDIA enabled"
2523         https://bugs.webkit.org/show_bug.cgi?id=177803
2524         http://trac.webkit.org/changeset/223148
2525
2526 2017-10-10  Zalan Bujtas  <zalan@apple.com>
2527
2528         AccessibilityRenderObject should not hold a raw pointer to RenderObject
2529         https://bugs.webkit.org/show_bug.cgi?id=178144
2530         <rdar://problem/34919287>
2531
2532         Reviewed by Chris Fleizach.
2533
2534         m_renderer's lifetime is not directly tied to the AX wrapper object's lifetime.
2535
2536         Covered by existing tests.
2537
2538         * accessibility/AccessibilityListBox.cpp:
2539         (WebCore::AccessibilityListBox::elementAccessibilityHitTest const):
2540         * accessibility/AccessibilityMathMLElement.cpp:
2541         (WebCore::AccessibilityMathMLElement::isMathFenceOperator const):
2542         (WebCore::AccessibilityMathMLElement::isMathSeparatorOperator const):
2543         (WebCore::AccessibilityMathMLElement::mathLineThickness const):
2544         * accessibility/AccessibilityMenuList.cpp:
2545         (WebCore::AccessibilityMenuList::press):
2546         (WebCore::AccessibilityMenuList::isCollapsed const):
2547         * accessibility/AccessibilityRenderObject.cpp:
2548         (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
2549         (WebCore::AccessibilityRenderObject::renderBoxModelObject const):
2550         (WebCore::AccessibilityRenderObject::setRenderer):
2551         (WebCore::AccessibilityRenderObject::previousSibling const):
2552         (WebCore::AccessibilityRenderObject::anchorElement const):
2553         (WebCore::AccessibilityRenderObject::helpText const):
2554         (WebCore::AccessibilityRenderObject::boundingBoxRect const):
2555         (WebCore::AccessibilityRenderObject::supportsPath const):
2556         (WebCore::AccessibilityRenderObject::elementPath const):
2557         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
2558         (WebCore::AccessibilityRenderObject::index const):
2559         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
2560         (WebCore::AccessibilityRenderObject::observableObject const):
2561         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
2562         (WebCore::AccessibilityRenderObject::textChanged):
2563         (WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
2564         (WebCore::AccessibilityRenderObject::roleValueForMSAA const):
2565         (WebCore::AccessibilityRenderObject::getScrollableAreaIfScrollable const):
2566         (WebCore::AccessibilityRenderObject::scrollTo const):
2567         * accessibility/AccessibilityRenderObject.h:
2568         (WebCore::AccessibilityRenderObject::setRenderObject):
2569         * accessibility/AccessibilitySlider.cpp:
2570         (WebCore::AccessibilitySlider::elementAccessibilityHitTest const):
2571         * accessibility/AccessibilityTable.cpp:
2572         (WebCore::AccessibilityTable::addChildren):
2573         * accessibility/AccessibilityTableCell.cpp:
2574         (WebCore::AccessibilityTableCell::computeAccessibilityIsIgnored const):
2575         (WebCore::AccessibilityTableCell::parentTable const):
2576         (WebCore::AccessibilityTableCell::rowIndexRange const):
2577         (WebCore::AccessibilityTableCell::columnIndexRange const):
2578         (WebCore::AccessibilityTableCell::titleUIElement const):
2579
2580 2017-10-10  Sam Weinig  <sam@webkit.org>
2581
2582         Replace copyKeysToVector/copyValuesToVector with copyToVector(map.keys())/copyToVector(map.values())
2583         https://bugs.webkit.org/show_bug.cgi?id=178102
2584
2585         Reviewed by Tim Horton.
2586
2587         * Modules/geolocation/Geolocation.cpp:
2588         (WebCore::Geolocation::Watchers::getNotifiersVector const):
2589         * Modules/indexeddb/IDBTransaction.cpp:
2590         (WebCore::IDBTransaction::connectionClosedFromServer):
2591         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2592         (WebCore::IDBClient::IDBConnectionProxy::connectionToServerLost):
2593         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2594         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
2595         * Modules/mediastream/MediaStream.cpp:
2596         (WebCore::MediaStream::getTracks const):
2597         * bindings/js/ScriptController.cpp:
2598         (WebCore::ScriptController::windowProxies):
2599         * css/CSSComputedStyleDeclaration.cpp:
2600         (WebCore::CSSComputedStyleDeclaration::item const):
2601         * dom/Document.cpp:
2602         (WebCore::Document::prepareForDestruction):
2603         * dom/DocumentMarkerController.cpp:
2604         (WebCore::DocumentMarkerController::removeMarkers):
2605         * inspector/InspectorWorkerAgent.cpp:
2606         (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies):
2607         * inspector/NetworkResourcesData.cpp:
2608         * loader/DocumentLoader.cpp:
2609         (WebCore::cancelAll):
2610         (WebCore::setAllDefersLoading):
2611         (WebCore::areAllLoadersPageCacheAcceptable):
2612         * loader/cache/MemoryCache.cpp:
2613         (WebCore::MemoryCache::forEachSessionResource):
2614         * loader/mac/DocumentLoaderMac.cpp:
2615         (WebCore::scheduleAll):
2616         (WebCore::unscheduleAll):
2617         * page/ResourceUsageThread.cpp:
2618         (WebCore::ResourceUsageThread::notifyObservers):
2619         * platform/mediastream/MediaStreamPrivate.cpp:
2620         (WebCore::MediaStreamPrivate::tracks const):
2621
2622             Replace copyKeysToVector / copyValuesToVector with copyToVector(map.keys()) / copyToVector(map.values())
2623
2624 2017-10-10  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2625
2626         Fix MSVC build with ENCRYPTED_MEDIA enabled
2627         https://bugs.webkit.org/show_bug.cgi?id=177803
2628
2629         Reviewed by Alex Christensen.
2630
2631         As a workaround for MSVC, a weak pointer of "this" is captured
2632         at the outermost lambda expression.
2633
2634         * Modules/encryptedmedia/MediaKeySession.cpp:
2635         (WebCore::MediaKeySession::generateRequest):
2636         (WebCore::MediaKeySession::load):
2637         (WebCore::MediaKeySession::update):
2638         (WebCore::MediaKeySession::close):
2639         (WebCore::MediaKeySession::remove):
2640         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2641         (WebCore::CDMInstanceClearKey::updateLicense):
2642         (WebCore::CDMInstanceClearKey::loadSession):
2643         (WebCore::CDMInstanceClearKey::removeSessionData):
2644
2645 2017-10-10  Joanmarie Diggs  <jdiggs@igalia.com>
2646
2647         AX: [ATK] ARIA form role should be mapped to ATK_ROLE_LANDMARK; not ATK_ROLE_FORM
2648         https://bugs.webkit.org/show_bug.cgi?id=178137
2649
2650         Reviewed by Chris Fleizach.
2651
2652         Expose the ARIA form role as ATK_ROLE_LANDMARK; continue to expose the HTML form
2653         element as ATK_ROLE_FORM.
2654
2655         No new tests needed due to existing coverage. Update expectations for roles-exposed.html.
2656
2657         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2658         (atkRole):
2659
2660 2017-10-10  Matt Rajca  <mrajca@apple.com>
2661
2662         Respect audio rate change restrictions in HTMLMediaElement::setVolume.
2663         https://bugs.webkit.org/show_bug.cgi?id=178140
2664
2665         Reviewed by Eric Carlson.
2666
2667         Tests: media/audio-playback-volume-changes-with-restrictions-and-user-gestures.html
2668                media/audio-playback-volume-changes-with-restrictions.html
2669
2670         It's currently possible for a website to start auto-playing media with a zero volume and then
2671         programmatically set the volume to a non-zero value without a user gesture. This code path didn't
2672         have to be considered previously because volume changes are not supported on iOS.
2673
2674         We currently pause media when an audio track comes in after an element has already started playing silently
2675         in mediaPlayerDidAddAudioTrack. This patch does the same when a non-zero volume is set after a media
2676         element already began playing silently and there is an audio rate change restriction.
2677
2678         * html/HTMLMediaElement.cpp:
2679         (WebCore::HTMLMediaElement::setVolume):
2680
2681 2017-10-10  Ryosuke Niwa  <rniwa@webkit.org>
2682
2683         Loading should be disabled while constructing the fragment in WebContentReader::readWebArchive
2684         https://bugs.webkit.org/show_bug.cgi?id=178118
2685
2686         Reviewed by Antti Koivisto.
2687
2688         Disable image loading while constructing the document fragment in WebContentReader::readWebArchive
2689         as we do in createFragmentAndAddResources for RTF/RTFD. This refactoring is needed to start using
2690         blob URL in the pasted document fragment for webkit.org/b/124391.
2691
2692         Also modified WebContentReader::readWebArchive to take a reference to SharedBuffer instead of a pointer.
2693
2694         No new tests since existing tests have been updated to cover this behavior change.
2695
2696         * editing/WebContentReader.h:
2697         * editing/cocoa/WebContentReaderCocoa.mm:
2698         (WebCore::WebContentReader::readWebArchive): Use DeferredLoadingScope to disable the loader and images
2699         while constructing the document fragment.
2700         * platform/Pasteboard.h:
2701         * platform/ios/PasteboardIOS.mm:
2702         (WebCore::readPasteboardWebContentDataForType):
2703         * platform/mac/PasteboardMac.mm:
2704         (WebCore::Pasteboard::read):
2705
2706 2017-10-10  Antti Koivisto  <antti@apple.com>
2707
2708         Layers should be destroyed by RenderLayerModelObject
2709         https://bugs.webkit.org/show_bug.cgi?id=178139
2710
2711         Reviewed by Simon Fraser.
2712
2713         Clean up some FIXMEs.
2714
2715         * rendering/RenderLayerModelObject.cpp:
2716         (WebCore::RenderLayerModelObject::willBeDestroyed):
2717         (WebCore::RenderLayerModelObject::destroyLayer):
2718         * rendering/RenderLayerModelObject.h:
2719         * rendering/RenderObject.cpp:
2720         (WebCore::RenderObject::willBeDestroyed):
2721
2722 2017-10-10  Chris Dumez  <cdumez@apple.com>
2723
2724         Entries API should recognize path starting with 2 slashes as valid absolute path
2725         https://bugs.webkit.org/show_bug.cgi?id=178135
2726
2727         Reviewed by Ryosuke Niwa.
2728
2729         Entries API should recognize paths starting with 2 slashes as valid absolute paths to match Chrome's behavior.
2730         See https://github.com/WICG/entries-api/commit/990454758005a6039655835503d551015e346d9d
2731
2732         This was causing us to fail some manual web-platform-tests.
2733
2734         No new tests, updated existing tests.
2735
2736         * Modules/entriesapi/DOMFileSystem.cpp:
2737         (WebCore::isValidPathSegment):
2738         (WebCore::isZeroOrMorePathSegmentsSeparatedBySlashes):
2739         (WebCore::isValidRelativeVirtualPath):
2740         (WebCore::isValidVirtualPath):
2741
2742 2017-10-10  Matt Lewis  <jlewis3@apple.com>
2743
2744         Unreviewed, rolling out r223110.
2745
2746         This caused consistent failures and timeouts on multiple
2747         platforms.
2748
2749         Reverted changeset:
2750
2751         "Delete button doesn't fully delete certain emoji"
2752         https://bugs.webkit.org/show_bug.cgi?id=178096
2753         http://trac.webkit.org/changeset/223110
2754
2755 2017-10-10  Antti Koivisto  <antti@apple.com>
2756
2757         RenderObject::destroy() should only be invoked after renderer has been removed from the tree
2758         https://bugs.webkit.org/show_bug.cgi?id=178075
2759
2760         Reviewed by Zalan Bujtas.
2761
2762         This patch fixes the remaining cases where the renderer is still in the tree while destroy()
2763         is called and adds the assert.
2764
2765         * rendering/RenderBlock.cpp:
2766         (WebCore::RenderBlock::removeLeftoverAnonymousBlock):
2767         (WebCore::RenderBlock::takeChild):
2768         * rendering/RenderBoxModelObject.cpp:
2769         (WebCore::RenderBoxModelObject::willBeDestroyed):
2770         * rendering/RenderLayer.cpp:
2771         (WebCore::RenderLayer::~RenderLayer):
2772
2773             Null the parent pointers for m_scrollCorner/m_resizer.
2774
2775         (WebCore::RenderLayer::calculateClipRects const):
2776         * rendering/RenderLayer.h:
2777         * rendering/RenderObject.cpp:
2778         (WebCore::RenderObject::willBeDestroyed):
2779         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2780         (WebCore::RenderObject::destroy):
2781
2782             Use RELEASE_ASSERT as these are cheap and important checks.
2783             Also turn isBeingDestroyed test into RELEASE_ASSERT.
2784             Remove AX call that no longer does anything.
2785
2786         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers): Deleted.
2787         * rendering/RenderObject.h:
2788         * rendering/RenderRubyBase.cpp:
2789         (WebCore::RenderRubyBase::moveBlockChildren):
2790         * rendering/RenderTableRow.cpp:
2791         (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows):
2792         (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows): Deleted.
2793
2794             Renamed and made this no longer destroy itself. The caller now takes care of that.
2795             Removed an unnecessary lambda.
2796
2797         * rendering/RenderTableRow.h:
2798         * style/RenderTreeUpdater.cpp:
2799         (WebCore::RenderTreeUpdater::tearDownRenderers):
2800         (WebCore::RenderTreeUpdater::tearDownRenderer):
2801         * style/RenderTreeUpdaterListItem.cpp:
2802         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2803
2804 2017-10-09  Antti Koivisto  <antti@apple.com>
2805
2806         Add isContinuation bit
2807         https://bugs.webkit.org/show_bug.cgi?id=178084
2808
2809         Reviewed by Zalan Bujtas.
2810
2811         Currently continuations are identified indirectly by comparing renderer pointer with the element renderer pointer.
2812         This is bug prone and fails to cover anonymous continuations.
2813
2814         * accessibility/AccessibilityRenderObject.cpp:
2815         (WebCore::firstChildConsideringContinuation):
2816         (WebCore::startOfContinuations):
2817         (WebCore::firstChildIsInlineContinuation):
2818         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
2819
2820             Ignore first-letter fragment. This worked before because first-letter renderers
2821             were mistakenly considered inline element continuations (see below).
2822
2823         * rendering/RenderBoxModelObject.cpp:
2824         (WebCore::RenderBoxModelObject::setContinuation):
2825         * rendering/RenderElement.cpp:
2826         (WebCore::RenderElement::RenderElement):
2827         * rendering/RenderElement.h:
2828         (WebCore::RenderElement::hasContinuation const):
2829         (WebCore::RenderElement::isContinuation const):
2830         (WebCore::RenderElement::setIsContinuation):
2831
2832             The new bit.
2833
2834         (WebCore::RenderElement::isElementContinuation const):
2835         (WebCore::RenderElement::isInlineElementContinuation const):
2836         * rendering/RenderInline.cpp:
2837         (WebCore::RenderInline::addChildIgnoringContinuation):
2838         (WebCore::RenderInline::cloneAsContinuation const):
2839         (WebCore::RenderInline::splitInlines):
2840         (WebCore::RenderInline::childBecameNonInline):
2841         (WebCore::RenderInline::clone const): Deleted.
2842         * rendering/RenderInline.h:
2843         * rendering/RenderObject.h:
2844         (WebCore::RenderObject::isAnonymousBlock const):
2845         (WebCore::RenderObject::isElementContinuation const): Deleted.
2846
2847             The old continuation test was 'node() && node()->renderer() != this'
2848             This was fragile as nulling the renderer will make it fail.
2849             It was also wrong for first-letter renderers (isElementContinuation was true for them).
2850
2851         (WebCore::RenderObject::isInlineElementContinuation const): Deleted.
2852
2853             Move to RenderElement.
2854
2855         (WebCore::RenderObject::isBlockElementContinuation const): Deleted.
2856
2857 2017-10-10  Joanmarie Diggs  <jdiggs@igalia.com>
2858
2859         AX: [ATK] STATE_CHECKABLE should be removed from radio buttons in radiogroups with aria-readonly="true"
2860         https://bugs.webkit.org/show_bug.cgi?id=177931
2861
2862         Reviewed by Chris Fleizach.
2863
2864         Add a check in canSetValueAttribute() for readonly radiogroup ancestors of
2865         radio buttons.
2866
2867         Test: accessibility/gtk/aria-readonly-radiogroup.html
2868
2869         * accessibility/AccessibilityNodeObject.cpp:
2870         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
2871         * accessibility/AccessibilityObject.cpp:
2872         (WebCore::AccessibilityObject::radioGroupAncestor const):
2873         * accessibility/AccessibilityObject.h:
2874
2875 2017-10-09  Chris Dumez  <cdumez@apple.com>
2876
2877         Calling fileSystemDirectoryEntry.getDirectory() with empty path should not fail
2878         https://bugs.webkit.org/show_bug.cgi?id=178114
2879
2880         Reviewed by Ryosuke Niwa.
2881
2882         Calling fileSystemDirectoryEntry.getDirectory() with empty/null/undefined path should not fail as per:
2883         - https://wicg.github.io/entries-api/#dom-filesystemdirectoryentry-getdirectory
2884
2885         The empty string is a valid path as per:
2886         - https://wicg.github.io/entries-api/#valid-path
2887
2888         This aligns out behavior with Chrome.
2889
2890         No new tests, updated existing test.
2891
2892         * Modules/entriesapi/DOMFileSystem.cpp:
2893         (WebCore::isValidVirtualPath):
2894         (WebCore::resolveRelativeVirtualPath):
2895
2896 2017-10-09  Chris Dumez  <cdumez@apple.com>
2897
2898         It should not be possible to submit a form that is disconnected
2899         https://bugs.webkit.org/show_bug.cgi?id=178099
2900
2901         Reviewed by Sam Weinig.
2902
2903         It should not be possible to submit a form that is disconnected. Both Firefox and Chrome agree with the specification.
2904
2905         This is as per:
2906         https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm (step 1)
2907         which refers to:
2908         https://html.spec.whatwg.org/multipage/links.html#cannot-navigate
2909
2910         Form cannot navigate when it is disconnected.
2911
2912         No new tests, rebaselined existing tests.
2913
2914         * html/HTMLFormElement.cpp:
2915         (WebCore::HTMLFormElement::prepareForSubmission):
2916
2917 2017-10-09  Myles C. Maxfield  <mmaxfield@apple.com>
2918
2919         Delete button doesn't fully delete certain emoji
2920         https://bugs.webkit.org/show_bug.cgi?id=178096
2921         <rdar://problem/34785106>
2922
2923         Reviewed by Simon Fraser.
2924
2925         System infrastructure for handling emoji changes every year. Instead of having
2926         custom code to specifically walk over codepoints, we should delegate to the
2927         system handling.
2928
2929         Test: editing/deleting/delete-emoji.html
2930
2931         * rendering/RenderText.cpp:
2932         (WebCore::RenderText::previousOffset const):
2933         (WebCore::RenderText::previousOffsetForBackwardDeletion const):
2934         (WebCore::RenderText::nextOffset const):
2935         (WebCore::isHangulLVT): Deleted.
2936         (WebCore::isMark): Deleted.
2937         (WebCore::isRegionalIndicator): Deleted.
2938         (WebCore::isInArmenianToLimbuRange): Deleted.
2939
2940 2017-10-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2941
2942         Image data should be coalesced if it comes in small chunks before updating the ImageSource
2943         https://bugs.webkit.org/show_bug.cgi?id=175890
2944
2945         Reviewed by Simon Fraser.
2946
2947         Coalesce the updates, which an Image makes when receiving encoded data in
2948         small chunks, for all platforms. Ensure the clients of the CachedImage
2949         won't be notified unless an update in the ImageSource happens.
2950
2951         I need to change some functions' names to better implement this patch. 
2952         The names of these functions have been confusing:
2953             CachedImage::addData(SharedBuffer&)
2954             CachedImage::addDataBuffer(const char* data, unsigned)
2955             CachedImage::addIncrementalDataBuffer(SharedBuffer&)
2956
2957         The image data is not buffered incrementally into the CachedImage. When
2958         new data is received, SubresourceLoader calls CachedImage to "update" its
2959         m_data with either a SharedBuffer or a data pointer. In either case the
2960         SharedBuffer or the pointer contains all the loaded data. SubresourceLoader
2961         calls CachedImage to update its m_data, to ensure its m_image is created 
2962         and to notify its clients with the new data.
2963
2964         The verb "add" in the functions' name is misleading. I am suggesting the
2965         following names instead:
2966             CachedImage::updateBuffer(SharedBuffer&)
2967             CachedImage::updateData(const char*, unsigned)
2968             CachedImage::doUpdateBuffer(SharedBuffer&)
2969
2970         The first two are the virtual ones. They are called form SubresourceLoader.
2971         The third one is the internal implementation to update the m_data member.
2972         The same names will be used in the following classes:
2973             CachedResource which is the base class of CachedImage
2974             CachedRawResource which is derived from CachedResource
2975             CachedTextTrack which is derived from CachedResource
2976
2977         * html/ImageDocument.cpp:
2978         (WebCore::ImageDocument::updateDuringParsing):
2979         * loader/SubresourceLoader.cpp:
2980         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
2981         * loader/cache/CachedImage.cpp:
2982         (WebCore::CachedImage::clearImage): Reset the update back off members.
2983         (WebCore::CachedImage::doUpdateBuffer): Don't update CachedImage with
2984         the new data if it comes in small chunks with fast rate.
2985         (WebCore::CachedImage::shouldDeferUpdateImageData const): This code is moved 
2986         from ImageSource::dataChanged().
2987         (WebCore::CachedImage::didUpdateImageData): Ditto.
2988         (WebCore::CachedImage::updateImageData):
2989         (WebCore::CachedImage::updateBuffer):
2990         (WebCore::CachedImage::updateData):
2991         (WebCore::CachedImage::finishLoading):
2992         (WebCore::CachedImage::addIncrementalDataBuffer): Deleted.
2993         (WebCore::CachedImage::setImageDataBuffer): Deleted.
2994         (WebCore::CachedImage::addDataBuffer): Deleted.
2995         (WebCore::CachedImage::addData): Deleted.
2996         * loader/cache/CachedImage.h:
2997         * loader/cache/CachedRawResource.cpp:
2998         (WebCore::CachedRawResource::updateBuffer):
2999         (WebCore::CachedRawResource::updateData):
3000         (WebCore::CachedRawResource::addDataBuffer): Deleted.
3001         (WebCore::CachedRawResource::addData): Deleted.
3002         * loader/cache/CachedRawResource.h:
3003         * loader/cache/CachedResource.cpp:
3004         (WebCore::CachedResource::updateBuffer):
3005         (WebCore::CachedResource::updateData):
3006         (WebCore::CachedResource::addDataBuffer): Deleted.
3007         (WebCore::CachedResource::addData): Deleted.
3008         * loader/cache/CachedResource.h:
3009         * loader/cache/CachedTextTrack.cpp:
3010         (WebCore::CachedTextTrack::doUpdateBuffer): Rename updateData() to doUpdateBuffer().
3011         (WebCore::CachedTextTrack::updateBuffer): Rename addDataBuffer() to updateBuffer().
3012         (WebCore::CachedTextTrack::finishLoading): Call the internal function doUpdateBuffer().
3013         (WebCore::CachedTextTrack::updateData): Deleted.
3014         (WebCore::CachedTextTrack::addDataBuffer): Deleted.
3015         * loader/cache/CachedTextTrack.h:
3016         * platform/graphics/ImageSource.cpp:
3017         (WebCore::ImageSource::dataChanged): Move the update back off code to CachedImage::updateData().
3018         * platform/graphics/ImageSource.h:
3019
3020 2017-10-09  Michael Saboff  <msaboff@apple.com>
3021
3022         Implement RegExp Unicode property escapes
3023         https://bugs.webkit.org/show_bug.cgi?id=172069
3024
3025         Reviewed by JF Bastien.
3026
3027         Refactoring change - Added BuiltInCharacterClassID:: prefix to uses of the enum.
3028
3029         * contentextensions/URLFilterParser.cpp:
3030         (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass):
3031
3032 2017-10-09  Andy Estes  <aestes@apple.com>
3033
3034         [Payment Request] Implement PaymentRequest.show() and PaymentRequest.hide()
3035         https://bugs.webkit.org/show_bug.cgi?id=178043
3036         <rdar://problem/34076639>
3037
3038         Reviewed by Tim Horton.
3039
3040         Tests: http/tests/paymentrequest/payment-request-abort-method.https.html
3041                http/tests/paymentrequest/payment-request-show-method.https.html
3042
3043         * Modules/applepay/PaymentCoordinator.h:
3044         * Modules/applepay/PaymentSession.h: Virtually inherited from PaymentSessionBase to
3045         accommodate ApplePayPaymentHandler inheriting from both this and PaymentHandler.
3046         (WebCore::PaymentSession::~PaymentSession): Deleted.
3047         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3048         (WebCore::paymentCoordinator): Virtually inherited from PaymentSessionBase to accommodate
3049         ApplePayPaymentHandler inheriting from both this and PaymentSession.
3050         (WebCore::ApplePayPaymentHandler::hasActiveSession): Added. Calls PaymentCoordinator::hasActiveSession().
3051         (WebCore::ApplePayPaymentHandler::show): Added. Calls PaymentCoordinator::beginPaymentSession().
3052         (WebCore::ApplePayPaymentHandler::hide): Added. Calls PaymentCoordinator::abortPaymentSession().
3053         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: Inherited from PaymentSession in
3054         addition to PaymentHandler so that this can be PaymentCoordinator active session.
3055         * Modules/paymentrequest/PaymentHandler.cpp:
3056         (WebCore::PaymentHandler::create):
3057         (WebCore::PaymentHandler::hasActiveSession):
3058         * Modules/paymentrequest/PaymentHandler.h:
3059         * Modules/paymentrequest/PaymentRequest.cpp:
3060         (WebCore::PaymentRequest::~PaymentRequest):
3061         (WebCore::PaymentRequest::show): Rejected the promise if PaymentCoordinator has an active session.
3062         (WebCore::PaymentRequest::abort): Called stop().
3063         (WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Returned true if state is
3064         Interactive and there is an active handler showing.
3065         (WebCore::PaymentRequest::stop): Hid the active session if it's showing, then set state to
3066         Closed and rejected the show promise.
3067         * Modules/paymentrequest/PaymentRequest.h:
3068         * Modules/paymentrequest/PaymentSessionBase.h: Added. Inherits from
3069         RefCounted<PaymentSessionBase> and defines a virtual destructor. This allows subclasses to
3070         virtually inherit a single ref-count to support multiple inheritance.
3071         * WebCore.xcodeproj/project.pbxproj:
3072         * bindings/scripts/CodeGeneratorJS.pm:
3073         (GetGnuVTableOffsetForType): Added ApplePaySession to the list of classes that need a vtable
3074         offset of 3.
3075         * page/MainFrame.cpp:
3076         (WebCore::MainFrame::setPaymentCoordinator): Added a setter for m_paymentCoordinator.
3077         * page/MainFrame.h:
3078         * testing/Internals.cpp:
3079         (WebCore::Internals::Internals): Set the main frame's payment coordinator to a new
3080         PaymentCoordinator with MockPaymentCoordinator as its client.
3081         * testing/MockPaymentCoordinator.cpp: Added a mock PaymentCoordinatorClient for testing.
3082         (WebCore::MockPaymentCoordinator::supportsVersion):
3083         (WebCore::MockPaymentCoordinator::canMakePayments):
3084         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
3085         (WebCore::MockPaymentCoordinator::openPaymentSetup):
3086         (WebCore::MockPaymentCoordinator::showPaymentUI):
3087         (WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):
3088         * testing/MockPaymentCoordinator.h: Added.
3089
3090 2017-10-09  Youenn Fablet  <youenn@apple.com>
3091
3092         Add quota to cache API
3093         https://bugs.webkit.org/show_bug.cgi?id=177552
3094
3095         Reviewed by Alex Christensen.
3096
3097         Tests: http/wpt/cache-storage/cache-quota.any.html
3098
3099         Storing padded opaque response body sizes within FetchResponse and CacheStorageConnection.
3100         See https://github.com/whatwg/storage/issues/31 for the rationale about this padding.
3101         Storing in CacheStorageConnection is needed for handling cloned network fetched created responses.
3102         Storing in FetchResponse is needed for handling cloned cache-storage created opaque responses.
3103
3104         Adding internals to query and set the fuzzed size of a response.
3105
3106         * Modules/cache/CacheStorageConnection.cpp:
3107         (WebCore::computeRealBodySize):
3108         (WebCore::CacheStorageConnection::computeRecordBodySize):
3109         (WebCore::CacheStorageConnection::setResponseBodySizeWithPadding):
3110         (WebCore::CacheStorageConnection::responseBodySizeWithPadding const):
3111         * Modules/cache/CacheStorageConnection.h:
3112         * Modules/cache/DOMCache.cpp:
3113         (WebCore::DOMCache::toConnectionRecord):
3114         (WebCore::DOMCache::updateRecords):
3115         * Modules/cache/DOMCache.h:
3116         * Modules/cache/DOMCacheEngine.cpp:
3117         (WebCore::DOMCacheEngine::errorToException):
3118         (WebCore::DOMCacheEngine::Record::copy const):
3119         * Modules/cache/DOMCacheEngine.h:
3120         * Modules/cache/WorkerCacheStorageConnection.cpp:
3121         (WebCore::toCrossThreadRecordData):
3122         (WebCore::fromCrossThreadRecordData):
3123         * Modules/fetch/FetchResponse.cpp:
3124         (WebCore::FetchResponse::clone):
3125         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
3126         * Modules/fetch/FetchResponse.h:
3127         * Modules/fetch/FetchResponse.idl:
3128         * testing/Internals.cpp:
3129         (WebCore::Internals::setResponseSizeWithPadding):
3130         (WebCore::Internals::responseSizeWithPadding const):
3131         * testing/Internals.h:
3132         * testing/Internals.idl:
3133
3134 2017-10-09  Zalan Bujtas  <zalan@apple.com>
3135
3136         Remove redundant RenderObject::virtualContinuation
3137         https://bugs.webkit.org/show_bug.cgi?id=178091
3138         <rdar://problem/34892906>
3139
3140         Reviewed by Antti Koivisto.
3141  
3142         virtualContinuation sounds like a feature of continuation, while it's just a (not super useful)helper override.
3143
3144         No change in functionality.
3145
3146         * rendering/RenderBlock.cpp:
3147         (WebCore::canMergeContiguousAnonymousBlocks):
3148         (WebCore::RenderBlock::takeChild):
3149         * rendering/RenderBlock.h:
3150         * rendering/RenderInline.h:
3151         * rendering/RenderObject.h:
3152         (WebCore::RenderObject::isBlockElementContinuation const):
3153         (WebCore::RenderObject::virtualContinuation const): Deleted.
3154
3155 2017-10-09  Dean Jackson  <dino@apple.com>
3156
3157         [WebGL] Third IOSurface buffer might be allocated with the wrong size
3158         https://bugs.webkit.org/show_bug.cgi?id=178092
3159         <rdar://problem/34893173>
3160
3161         Reviewed by Jer Noble.
3162
3163         If the WebGL canvas resizes after the third buffer was allocated, it
3164         was never getting told that its backing store should be thrown away.
3165
3166         * platform/graphics/cocoa/WebGLLayer.mm: Allocate the third buffer at
3167         the same time as the first two.
3168         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
3169         (-[WebGLLayer bindFramebufferToNextAvailableSurface]):
3170
3171 2017-10-09  Sam Weinig  <sam@webkit.org>
3172
3173         Make HashMap::keys() and HashMap::values() work with WTF::map/WTF::copyToVector
3174         https://bugs.webkit.org/show_bug.cgi?id=178072
3175
3176         Reviewed by Darin Adler.
3177
3178         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
3179         (WebCore::MediaSelectionGroupAVFObjC::options):
3180         
3181             Update for type change for HashMap::values().
3182             
3183 2017-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3184
3185         Unreviewed, another build fix attempt after r223031
3186
3187         The default constructor of DragTargetResponse is also invoked via initializer list in EventHandler.cpp, so we'll
3188         need to explicitly declare this constructor in the header.
3189
3190         * page/EventHandler.h:
3191
3192 2017-10-09  Ryan Haddad  <ryanhaddad@apple.com>
3193
3194         Unreviewed, rolling out r223021.
3195
3196         LayoutTests added with this change are failing.
3197
3198         Reverted changeset:
3199
3200         "[Payment Request] Implement PaymentRequest.show() and
3201         PaymentRequest.hide()"
3202         https://bugs.webkit.org/show_bug.cgi?id=178043
3203         http://trac.webkit.org/changeset/223021
3204
3205 2017-10-09  Jeremy Jones  <jeremyj@apple.com>
3206
3207         Blurry captions on retina screens.
3208         https://bugs.webkit.org/show_bug.cgi?id=177560
3209         rdar://problem/17913388
3210
3211         Reviewed by Jer Noble.
3212
3213         No new tests because the contents scale of the captions layer is not exposed to the DOM.
3214
3215         The captions layer contents scale needs to take into account the device screen scale to get the correct resolution for captions.
3216
3217         * html/shadow/MediaControlElements.cpp:
3218         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
3219         (WebCore::MediaControlTextTrackContainerElement::updateSizes):
3220
3221 2017-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3222
3223         Unreviewed, fix the Windows build after r223031
3224
3225         Speculative build fix; no change in behavior.
3226
3227         * page/EventHandler.h:
3228         (WebCore::EventHandler::DragTargetResponse::DragTargetResponse):
3229
3230 2017-10-09  Alex Christensen  <achristensen@webkit.org>
3231
3232         Reduce includes in Document.h
3233         https://bugs.webkit.org/show_bug.cgi?id=178035
3234
3235         Reviewed by Darin Adler.
3236
3237         * dom/Document.h:
3238
3239 2017-10-09  Joanmarie Diggs  <jdiggs@igalia.com>
3240
3241         AX: [ATK] Explicitly-set aria-sort value of "none" should be exposed as an object attribute
3242         https://bugs.webkit.org/show_bug.cgi?id=177955
3243
3244         Reviewed by Chris Fleizach.
3245
3246         Expose "none" as the value of aria-sort when the attribute is present and not
3247         one of the other valid sort types. Also add a new AccessibilitySortDirection,
3248         SortDirectionInvalid. This is currently only being used when the sort direction
3249         is sought for a role which does not support this ARIA attribute, but might come
3250         in handy if we want to add further sanity checks on the author-provided values.
3251
3252         Test: accessibility/gtk/aria-sort-values.html
3253
3254         * accessibility/AccessibilityObject.cpp:
3255         (WebCore::AccessibilityObject::sortDirection const):
3256         * accessibility/AccessibilityObject.h:
3257         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
3258         (webkitAccessibleGetAttributes):
3259         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3260         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
3261
3262 2017-10-09  Robin Morisset  <rmorisset@apple.com>
3263
3264         Make the names of the options consistent 
3265         https://bugs.webkit.org/show_bug.cgi?id=177933
3266
3267         Reviewed by Saam Barati.
3268
3269         No functional change, just fixing comments.
3270
3271         * Modules/mediasource/MediaSource.cpp:
3272         (WebCore::MediaSource::buffered const):
3273         (WebCore::MediaSource::monitorSourceBuffers):
3274         * Modules/webaudio/AudioBufferSourceNode.cpp:
3275         (WebCore::AudioBufferSourceNode::process):
3276         * bindings/scripts/generate-bindings.pl:
3277         * css/StyleResolver.cpp:
3278         (WebCore::StyleResolver::adjustRenderStyle):
3279         * editing/BreakBlockquoteCommand.cpp:
3280         (WebCore::BreakBlockquoteCommand::doApply):
3281         * editing/ReplaceSelectionCommand.cpp:
3282         (WebCore::ReplaceSelectionCommand::doApply):
3283         * editing/VisibleSelection.cpp:
3284         (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
3285         * editing/VisibleUnits.cpp:
3286         (WebCore::closestWordBoundaryForPosition):
3287         * html/parser/AtomicHTMLToken.h:
3288         * html/parser/HTMLDocumentParser.cpp:
3289         (WebCore::HTMLDocumentParser::end):
3290         * inspector/InspectorOverlayPage.js:
3291         (reset):
3292         * page/ViewportConfiguration.cpp:
3293         (WebCore::ViewportConfiguration::layoutWidth const):
3294         (WebCore::ViewportConfiguration::layoutHeight const):
3295         * platform/graphics/FloatPolygon.h:
3296         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
3297         (WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
3298         * platform/graphics/filters/FilterOperation.h:
3299         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
3300         (WebCore::GraphicsContext3D::texImage2D):
3301         * platform/mac/WidgetMac.mm:
3302         (WebCore::safeRemoveFromSuperview):
3303         * rendering/RenderBlockFlow.cpp:
3304         (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo):
3305         * rendering/RenderBlockFlow.h:
3306         * rendering/RenderBox.cpp:
3307         (WebCore::RenderBox::computePositionedLogicalWidthReplaced const):
3308         * rendering/RenderObject.cpp:
3309         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
3310         * rendering/RenderTheme.cpp:
3311         (WebCore::RenderTheme::disabledTextColor const):
3312         * style/ClassChangeInvalidation.cpp:
3313         (WebCore::Style::computeClassChange):
3314         * style/StyleScope.cpp:
3315         (WebCore::Style::Scope::didChangeStyleSheetEnvironment):
3316         * svg/SVGAltGlyphDefElement.cpp:
3317         (WebCore::SVGAltGlyphDefElement::hasValidGlyphElements const):
3318
3319 2017-10-09  Adrian Perez de Castro  <aperez@igalia.com>
3320
3321         [WPE][GTK] Propagate libepoxy compiler flags obtained from pkg-config
3322         https://bugs.webkit.org/show_bug.cgi?id=178081
3323
3324         Reviewed by Carlos Alberto Lopez Perez.
3325
3326         No new tests needed.
3327
3328         * CMakeLists.txt: Use ${LIBEPOXY_DEFINITIONS} for building WebCore.
3329
3330 2017-10-09  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3331
3332         [Readable Streams API] Implement canCloseOrEnqueue
3333         https://bugs.webkit.org/show_bug.cgi?id=178005
3334
3335         Reviewed by Youenn Fablet.
3336
3337         Implemented readableStreamDefaultControllerCanCloseOrEnqueue [1]. This is
3338         just a refactoring (based on spec) aiming at factorizing a set of tests
3339         that are done at multiple places.
3340
3341         [1] https://streams.spec.whatwg.org/#readable-stream-default-controller-can-close-or-enqueue
3342
3343         No new tests (refactoring, no new behavior).
3344
3345         * Modules/streams/ReadableStreamDefaultController.js:
3346         (enqueue): Updated.
3347         (close): Updated.
3348         * Modules/streams/ReadableStreamInternals.js:
3349         (readableStreamDefaultControllerClose): Updated.
3350         (readableStreamDefaultControllerCanCloseOrEnqueue): Added.
3351
3352 2017-10-05  Frederic Wang  <fwang@igalia.com>
3353
3354         Remove WOFF2 from Source/ThirdParty.
3355         https://bugs.webkit.org/show_bug.cgi?id=177862
3356
3357         Reviewed by Michael Catanzaro.
3358
3359         No new tests, already covered by existing tests.
3360
3361         * CMakeLists.txt: Use the system brotli/woff2 headers/libraries.
3362
3363 2017-10-08  Darin Adler  <darin@apple.com>
3364
3365         Update HTMLOListElement.start to behavior from latest HTML specification
3366         https://bugs.webkit.org/show_bug.cgi?id=178057
3367
3368         Reviewed by Chris Dumez.
3369
3370         * html/HTMLOListElement.cpp:
3371         (optionalValue): Added. Helper function that we can put into Expected.h later
3372         if we like; makes it easier to turn Expected into std::optional.
3373         (WebCore::HTMLOListElement::HTMLOListElement): Moved data member initialization
3374         into class definition so it doesn't have to be done here.
3375         (WebCore::HTMLOListElement::parseAttribute): Simplified using the new
3376         optionalValue function. Moved the call to update values in here since it's
3377         a trivial one-liner (albeit done twice).
3378         (WebCore::HTMLOListElement::updateItemValues): Deleted. Moved this into the
3379         parseAttribute function.
3380         (WebCore::HTMLOListElement::itemCount): Updated to use std::optional instead
3381         of a separate m_shouldRecalculateItemCount flag. Also inlined the
3382         recalculateItemCount function since it's a trivial one-liner.
3383         (WebCore::HTMLOListElement::itemCountAfterLayout): Deleted. The only use of
3384         this was to implement the now-obsolete behavior of the start attribute.
3385         (WebCore::HTMLOListElement::recalculateItemCount): Deleted. Moved this into
3386         the itemCount function.
3387
3388         * html/HTMLOListElement.h: Changed startForBindings to return 1 when start