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