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