78b0b0e6cb6bee5cb2fdb359a3af775270909e65
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-04  Daniel Bates  <dabates@apple.com>
2
3         [iOS] Caret x-position in empty text area does not match text field
4         https://bugs.webkit.org/show_bug.cgi?id=195125
5         <rdar://problem/47161070>
6
7         Remove the word "use" in the added comment to make it read well.
8
9         * css/html.css:
10         (textarea):
11
12 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
13
14         ITMLKit Inspector: Data Bindings / Associated Data for nodes
15         https://bugs.webkit.org/show_bug.cgi?id=195290
16         <rdar://problem/48304019>
17
18         Reviewed by Devin Rousso.
19
20         * inspector/agents/InspectorDOMAgent.h:
21         * inspector/agents/InspectorDOMAgent.cpp:
22         (WebCore::InspectorDOMAgent::getDataBindingsForNode):
23         (WebCore::InspectorDOMAgent::getAssociatedDataForNode):
24         Stub these for web pages, they will only be used for ITMLKit right now.
25
26 2019-03-04  Daniel Bates  <dabates@apple.com>
27
28         [iOS] Caret x-position in empty text area does not match text field
29         https://bugs.webkit.org/show_bug.cgi?id=195125
30         <rdar://problem/47161070>
31
32         Reviewed by Darin Adler.
33
34         Fix up User Agent styles for <textarea> on iOS such that they have the same left padding
35         width and same text-indent as <input type="text">. This makes the x-position of the caret
36         in an empty textarea match the position of the caret in an empty text field.
37
38         Test: fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
39
40         * css/html.css:
41         (textarea): For iOS Family, do not use the padding shorthand property. Instead explicitly specify
42         padding-top and padding-bottom to be 2px to keep our current behavior (because it looks reasonable)
43         and do not specify left and right padding so that we inherit the padding set earlier in this file.
44         (textarea::placeholder): Deleted. This was added to "try" to make fix up the position of the placeholder
45         text so as to match the position of the textarea's inner text and the position of a text field's inner
46         text. This fix up may have worked out visually when it was added, but based on the discovery of the
47         hardcoded 3px left and right padding (see below remark) it looks like it was always one pixel too short.
48         * html/HTMLTextAreaElement.cpp:
49         (WebCore::HTMLTextAreaElement::createInnerTextStyle): Remove hardcoded 3px left and right padding.
50
51 2019-03-04  Youenn Fablet  <youenn@apple.com>
52
53         Make sure to correctly notify of end of a ServiceWorkerJob when the context is stopped
54         https://bugs.webkit.org/show_bug.cgi?id=195195
55
56         Reviewed by Chris Dumez.
57
58         Before the patch, we were notifying that some jobs were finished too aggressively at context stop time.
59         This was confusing the Network Process.
60         Only notify such jobs that have pending loads.
61         Improve the tracking of jobs doing registration resolution to ensure the Network Process gets notified
62         in case of a registration promise being resolved but the settling callback being not yet called while the context is stopped.
63
64         Covered by existing tests not crashing anymore, in particular imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html.
65
66         * workers/service/ServiceWorkerContainer.cpp:
67         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
68         (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
69         (WebCore::ServiceWorkerContainer::stop):
70         * workers/service/ServiceWorkerContainer.h:
71         * workers/service/ServiceWorkerJob.cpp:
72         (WebCore::ServiceWorkerJob::cancelPendingLoad):
73         * workers/service/ServiceWorkerJob.h:
74         (WebCore::ServiceWorkerJob::isLoading const):
75
76 2019-03-04  Chris Dumez  <cdumez@apple.com>
77
78         [iOS] Improve our file picker
79         https://bugs.webkit.org/show_bug.cgi?id=195284
80         <rdar://problem/45655856>
81
82         Reviewed by Tim Horton and Wenson Hsieh.
83
84         Export UTIUtilities.h so that it can be used from WebKit2.
85
86         * WebCore.xcodeproj/project.pbxproj:
87
88 2019-03-04  Zalan Bujtas  <zalan@apple.com>
89
90         [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
91         https://bugs.webkit.org/show_bug.cgi?id=195286
92
93         Reviewed by Simon Fraser.
94
95         Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
96         This patch also renames a couple of functions to follow the didStart/didFinish pattern.
97
98         * page/ios/ContentChangeObserver.cpp:
99         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
100         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
101         (WebCore::ContentChangeObserver::styleRecalcDidStart):
102         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
103         (WebCore::ContentChangeObserver::mouseMovedDidStart):
104         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
105         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
106         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
107         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
108         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
109         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
110         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
111         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
112         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
113         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
114         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
115         (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
116         (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
117         (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
118         (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
119         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
120         * page/ios/ContentChangeObserver.h:
121         (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
122         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
123         (WebCore::ContentChangeObserver::isObservingStyleRecalc const):
124         (WebCore::ContentChangeObserver::isObservingContentChanges const):
125         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
126         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
127         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.
128
129 2019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
130
131         [JSC] Offer @makeTypeError instead of exposing @TypeError
132         https://bugs.webkit.org/show_bug.cgi?id=193858
133
134         Reviewed by Mark Lam.
135
136         Use @makeTypeError instead.
137
138         * Modules/mediastream/RTCPeerConnection.js:
139         * Modules/mediastream/RTCPeerConnectionInternals.js:
140         * Modules/streams/ReadableByteStreamInternals.js:
141         (readableByteStreamControllerClose):
142         (readableByteStreamControllerPullInto):
143         * Modules/streams/ReadableStream.js:
144         (cancel):
145         (pipeTo):
146         * Modules/streams/ReadableStreamBYOBReader.js:
147         (cancel):
148         (read):
149         * Modules/streams/ReadableStreamDefaultReader.js:
150         (cancel):
151         (read):
152         * Modules/streams/ReadableStreamInternals.js:
153         (readableStreamReaderGenericRelease):
154         * Modules/streams/WritableStream.js:
155         (abort):
156         (close):
157         (write):
158         (getter.closed):
159         (getter.ready):
160
161 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
162
163         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
164         https://bugs.webkit.org/show_bug.cgi?id=195258
165
166         Reviewed by Antti Koivisto.
167
168         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
169         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
170         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
171         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
172
173         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
174         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
175         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
176         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
177         references to GraphicsLayers before that becomes safe).
178         
179         The actual fix that allows overflow scrollbars to show is the change in
180         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
181         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
182
183         * SourcesCocoa.txt:
184         * WebCore.xcodeproj/project.pbxproj:
185         * page/scrolling/AsyncScrollingCoordinator.cpp:
186         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
187         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
188         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
189         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
190         * page/scrolling/ScrollingCoordinator.h:
191         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
192         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
193         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
194         (WebCore::ScrollingStateFrameScrollingNode::setVerticalScrollbarLayer): Deleted.
195         (WebCore::ScrollingStateFrameScrollingNode::setHorizontalScrollbarLayer): Deleted.
196         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars): Deleted.
197         * page/scrolling/ScrollingStateFrameScrollingNode.h:
198         * page/scrolling/ScrollingStateScrollingNode.cpp:
199         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
200         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
201         (WebCore::ScrollingStateScrollingNode::setHorizontalScrollbarLayer):
202         (WebCore::ScrollingStateScrollingNode::setVerticalScrollbarLayer):
203         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
204         * page/scrolling/ScrollingStateScrollingNode.h:
205         (WebCore::ScrollingStateScrollingNode::horizontalScrollbarLayer const):
206         (WebCore::ScrollingStateScrollingNode::verticalScrollbarLayer const):
207         (WebCore::ScrollingStateScrollingNode::verticalScrollerImp const):
208         (WebCore::ScrollingStateScrollingNode::horizontalScrollerImp const):
209         * page/scrolling/ScrollingTree.cpp:
210         (WebCore::ScrollingTree::setOrClearLatchedNode):
211         (WebCore::ScrollingTree::handleWheelEvent):
212         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
213         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
214         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
215         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
216         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
217         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
218         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
219         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac): Deleted.
220         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread): Deleted.
221         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
222         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
223         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
224         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
225         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers):
226         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
227         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
228         (WebCore::ScrollingTreeScrollingNodeDelegateMac::~ScrollingTreeScrollingNodeDelegateMac):
229         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
230         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
231         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
232         (WebCore::ScrollingTreeScrollingNodeDelegateMac::releaseReferencesToScrollerImpsOnTheMainThread):
233         * platform/ScrollbarThemeComposite.h:
234         * rendering/RenderLayerCompositor.cpp:
235         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
236         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
237         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
238         * rendering/RenderLayerCompositor.h:
239
240 2019-03-04  Jer Noble  <jer.noble@apple.com>
241
242         Remove HEVC as a codec requiring hardware support.
243         https://bugs.webkit.org/show_bug.cgi?id=194960
244         <rdar://problem/47741432>
245
246         Reviewed by Eric Carlson.
247
248         * page/cocoa/SettingsBaseCocoa.mm:
249         (WebCore::SettingsBase::defaultMediaContentTypesRequiringHardwareSupport):
250
251 2019-03-04  Jer Noble  <jer.noble@apple.com>
252
253         [iOS] Fullscreen "stay in page" option breaks video playback
254         https://bugs.webkit.org/show_bug.cgi?id=195277
255         <rdar://problem/48537317>
256
257         Reviewed by Eric Carlson.
258
259         Add a LOG entry when playback is rejected due to media playback suspension.
260
261         * html/MediaElementSession.cpp:
262         (WebCore::MediaElementSession::playbackPermitted const):
263
264 2019-03-04  Tim Horton  <timothy_horton@apple.com>
265
266         Fix the build.
267
268         * dom/Document.h:
269
270 2019-03-03  Zalan Bujtas  <zalan@apple.com>
271
272         [ContentChangeObserver] Content observation should be limited to the current document.
273         https://bugs.webkit.org/show_bug.cgi?id=195256
274         <rdar://problem/48544402>
275
276         Move ContentChangeObserver from Page to Document.
277         It limits content observation to the target node's owner document.
278
279         Reviewed by Simon Fraser.
280
281         * dom/Document.cpp:
282         (WebCore::m_contentChangeObserver):
283         (WebCore::Document::updateStyleIfNeeded):
284         (WebCore::Document::willDetachPage):
285         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
286         (WebCore::m_undoManager): Deleted.
287         * dom/Document.h:
288         (WebCore::Document::contentChangeObserver):
289         * page/DOMTimer.cpp:
290         (WebCore::DOMTimer::install):
291         (WebCore::DOMTimer::removeById):
292         (WebCore::DOMTimer::fired):
293         * page/Frame.cpp:
294         (WebCore::Frame::willDetachPage):
295         * page/Page.cpp:
296         (WebCore::Page::Page):
297         * page/Page.h:
298         (WebCore::Page::pointerLockController const):
299         (WebCore::Page::contentChangeObserver): Deleted.
300         * page/ios/ContentChangeObserver.cpp:
301         (WebCore::ContentChangeObserver::ContentChangeObserver):
302         (WebCore::ContentChangeObserver::didInstallDOMTimer):
303         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
304         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
305         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
306         (WebCore::ContentChangeObserver::startObservingMouseMoved):
307         (WebCore::ContentChangeObserver::hasDeterminateState const):
308         (WebCore::ContentChangeObserver::adjustObservedState):
309         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded):
310         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
311         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
312         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
313         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
314         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
315         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
316         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
317         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
318         (WebCore::hasPendingStyleRecalc): Deleted.
319         * page/ios/ContentChangeObserver.h:
320         * page/ios/EventHandlerIOS.mm:
321         (WebCore::EventHandler::mouseMoved):
322         * rendering/updating/RenderTreeUpdater.cpp:
323         (WebCore::RenderTreeUpdater::updateElementRenderer):
324
325 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
326
327         Share more code for updating the state of frame scrolling nodes
328         https://bugs.webkit.org/show_bug.cgi?id=195254
329
330         Reviewed by Antti Koivisto.
331
332         Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
333         AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
334         RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
335         ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
336         state tree.
337         
338         We also share code between updating ScrollingStateFrameScrollingNodes and
339         ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
340         Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
341         ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
342         on macOS.
343
344         * page/scrolling/AsyncScrollingCoordinator.cpp:
345         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
346         (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
347         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
348         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
349         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
350         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
351         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
352         * page/scrolling/AsyncScrollingCoordinator.h:
353         * page/scrolling/ScrollingCoordinator.h:
354         (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
355         (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
356         (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
357         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
358         (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
359         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
360         * platform/ScrollView.h:
361         (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
362         (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
363         * platform/ScrollableArea.cpp:
364         (WebCore::ScrollableArea::reachableTotalContentsSize const):
365         * platform/ScrollableArea.h:
366         (WebCore::ScrollableArea::horizontalScrollbarMode const):
367         (WebCore::ScrollableArea::verticalScrollbarMode const):
368         * rendering/RenderLayer.cpp:
369         (WebCore::RenderLayer::overhangAmount const):
370         (WebCore::RenderLayer::reachableTotalContentsSize const):
371         (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
372         * rendering/RenderLayer.h:
373         * rendering/RenderLayerCompositor.cpp:
374         (WebCore::RenderLayerCompositor::updateCompositingLayers):
375         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
376         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
377         (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
378         (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
379         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
380         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
381         (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
382         (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
383         (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
384         * rendering/RenderLayerCompositor.h:
385
386 2019-03-02  Darin Adler  <darin@apple.com>
387
388         Retire legacy dtoa function and DecimalNumber class
389         https://bugs.webkit.org/show_bug.cgi?id=195253
390
391         Reviewed by Daniel Bates.
392
393         * css/CSSPrimitiveValue.cpp:
394         (WebCore::CSSPrimitiveValue::formatNumberValue const): Use makeString instead
395         of DecimalNumber. Also changed return type to String and use StringView and
396         removed special handling of literals.
397         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed an
398         unnecessary use of StringBuilder.
399
400         * css/CSSPrimitiveValue.h: Updated for changes to formatNumberValue.
401
402 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
403
404         [SOUP] Cleanups in SoupNetworkSession
405         https://bugs.webkit.org/show_bug.cgi?id=195247
406
407         Reviewed by Daniel Bates.
408
409         This renames clientCertificates to allowedCertificates, since they are not client
410         certificates at all, but server certificates. It also adds a using statement to avoid
411         repeating the long type of the map, and avoids an unnecessary copy.
412
413         * platform/network/soup/SoupNetworkSession.cpp:
414         (WebCore::allowedCertificates):
415         (WebCore::SoupNetworkSession::checkTLSErrors):
416         (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
417         (WebCore::clientCertificates): Deleted.
418
419 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
420
421         -Wformat error in SharedBuffer::tryCreateArrayBuffer
422         https://bugs.webkit.org/show_bug.cgi?id=195004
423
424         Reviewed by Darin Adler.
425
426         Seems C++ has no format specifier appropriate for printing the result of sizeof. We should
427         just not try to print it. Anyway, that's easy in this case, because sizeof(char) is
428         guaranteed to be 1. This code was an attempt to be pedantic to account for mythical systems
429         with char larger than one byte, but perhaps it didn't realize sizeof always returns
430         multiples of char and so sizeof(char) is always one even on such mythical systems.
431
432         Note the sizeof(char) use two lines up is left since it's not clear that switching it to 1
433         would actually be more readable.
434
435         * platform/SharedBuffer.cpp:
436         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
437
438 2019-03-03  Tim Horton  <timothy_horton@apple.com>
439
440         Remove some more unused 32-bit code
441         https://bugs.webkit.org/show_bug.cgi?id=195255
442
443         Reviewed by Darin Adler.
444
445         * platform/gamepad/cocoa/GameControllerGamepad.h:
446         * platform/gamepad/cocoa/GameControllerGamepad.mm:
447         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
448         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
449         * platform/graphics/cocoa/FontCascadeCocoa.mm:
450         * platform/mac/PlatformEventFactoryMac.mm:
451         (WebCore::globalPointForEvent):
452         (WebCore::pointForEvent):
453         (WebCore::mouseButtonForEvent):
454         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
455         * rendering/RenderThemeMac.mm:
456         (WebCore::RenderThemeMac::servicesRolloverButtonCell const):
457         (WebCore::RenderThemeMac::paintImageControlsButton):
458         (WebCore::RenderThemeMac::imageControlsButtonSize const):
459         (WebCore::RenderThemeMac::imageControlsButtonPositionOffset const):
460
461 2019-03-02  Zalan Bujtas  <zalan@apple.com>
462
463         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
464         https://bugs.webkit.org/show_bug.cgi?id=195252
465         <rdar://problem/48539446>
466
467         Reviewed by Simon Fraser.
468
469         Scope the mouse-moved event to make the callsites less error-prone. 
470
471         * page/ios/ContentChangeObserver.cpp:
472         (WebCore::ContentChangeObserver::startObservingMouseMoved):
473         (WebCore::ContentChangeObserver::stopObservingMouseMoved):
474         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
475         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
476         (WebCore::ContentChangeObserver::startObservingContentChanges): Deleted.
477         (WebCore::ContentChangeObserver::stopObservingContentChanges): Deleted.
478         * page/ios/ContentChangeObserver.h:
479         * page/ios/EventHandlerIOS.mm:
480         (WebCore::EventHandler::mouseMoved):
481
482 2019-03-02  Zalan Bujtas  <zalan@apple.com>
483
484         [ContentChangeObserver] Introduce ContentChangeObserver::adjustObservedState
485         https://bugs.webkit.org/show_bug.cgi?id=195244
486         <rdar://problem/48536737>
487
488         Reviewed by Simon Fraser.
489
490         Move state change handling code to adjustObservedState() and introduce signalContentChangeIfNeeded() to
491         let the client know about the state change (or lack of state change).
492
493         Test: fast/events/touch/ios/visibility-change-happens-at-the-second-timer.html
494
495         * page/ios/ContentChangeObserver.cpp:
496         (WebCore::ContentChangeObserver::didInstallDOMTimer):
497         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
498         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
499         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
500         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
501         (WebCore::ContentChangeObserver::didContentVisibilityChange):
502         (WebCore::ContentChangeObserver::addObservedDOMTimer):
503         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
504         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
505         (WebCore::ContentChangeObserver::adjustObservedState):
506         (WebCore::ContentChangeObserver::signalContentChangeIfNeeded):
507         * page/ios/ContentChangeObserver.h:
508         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
509         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
510         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
511
512 2019-03-02  Zalan Bujtas  <zalan@apple.com>
513
514         [ContentChangeObserver] Move away from WKContentChange values
515         https://bugs.webkit.org/show_bug.cgi?id=195240
516         <rdar://problem/48532358>
517
518         Reviewed by Simon Fraser.
519
520         This is in preparation for moving towards a state machine-like implementation.
521
522         * page/ios/ContentChangeObserver.cpp:
523         (WebCore::ContentChangeObserver::didInstallDOMTimer): Do not install the timer if we are already in "hover" state.
524         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
525         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
526         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
527         (WebCore::ContentChangeObserver::startObservingStyleRecalc): No need to start observing the style recalc if we are already in "hover" state.
528         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
529         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
530         (WebCore::ContentChangeObserver::didContentVisibilityChange):
531         (WebCore::ContentChangeObserver::startObservingContentChanges):
532         (WebCore::ContentChangeObserver::observedContentChange const):
533         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
534         (WebCore::ContentChangeObserver::hasDeterminedState const):
535         (WebCore::ContentChangeObserver::observedContentChange): Deleted.
536         (WebCore::ContentChangeObserver::resetObservedContentChange): Deleted.
537         (WebCore::ContentChangeObserver::setObservedContentChange): Deleted.
538         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
539         * page/ios/ContentChangeObserver.h:
540         (WebCore::ContentChangeObserver::addObservedDOMTimer):
541         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
542         (WebCore::ContentChangeObserver::hasVisibleChangeState const):
543         (WebCore::ContentChangeObserver::hasObservedDOMTimer const):
544         (WebCore::ContentChangeObserver::setHasNoChangeState):
545         (WebCore::ContentChangeObserver::setHasIndeterminateState):
546         (WebCore::ContentChangeObserver::setHasVisibleChangeState):
547         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const): Deleted.
548
549 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
550
551         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
552         https://bugs.webkit.org/show_bug.cgi?id=195053
553         <rdar://problem/48134710>
554
555         Reviewed by Ryosuke Niwa.
556
557         Plumb the document pasteboard identifier through the client when making a DOM paste access request. See WebKit
558         ChangeLog for more details.
559
560         Test: editing/pasteboard/ios/dom-paste-same-origin.html
561
562         * WebCore.xcodeproj/project.pbxproj:
563         * dom/DOMPasteAccess.h: Renamed from Source/WebCore/dom/DOMPasteAccessPolicy.h.
564
565         Introduce DOMPasteAccessResponse, which is either DeniedForGesture, GrantedForCommand, or GrantedForGesture. In
566         particular, when pasteboard identifiers match, we only grant access for the current paste command, rather than
567         throughout the user gesture.
568
569         * dom/UserGestureIndicator.h:
570         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
571         * loader/EmptyClients.cpp:
572         * page/EditorClient.h:
573         * page/Frame.cpp:
574         (WebCore::Frame::requestDOMPasteAccess):
575
576 2019-02-27  Darin Adler  <darin@apple.com>
577
578         Fixed makeString(float) to do shortest-form serialization without first converting to double
579         https://bugs.webkit.org/show_bug.cgi?id=195142
580
581         Reviewed by Daniel Bates.
582
583         * platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h.
584
585 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
586
587         REGRESSION (r242132): Incorrect positioning with multiple position:fixed elements
588         https://bugs.webkit.org/show_bug.cgi?id=195246
589
590         Reviewed by Frederic Wang.
591
592         r242132 introduced a bug where the management of 'cumulativeDelta' in ScrollingTree::notifyRelatedNodesRecursive
593         was incorrect. This value should propagate from ancestors to descendants, but not between siblings in the scrolling
594         tree, which it did, causing sibling position:fixed to behave incorrectly.
595
596         Test: scrollingcoordinator/mac/multiple-fixed.html
597
598         * page/scrolling/ScrollingTree.cpp:
599         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
600         * page/scrolling/ScrollingTree.h:
601
602 2019-03-02  Darin Adler  <darin@apple.com>
603
604         Improve some comments
605         https://bugs.webkit.org/show_bug.cgi?id=195243
606
607         Reviewed by Daniel Bates.
608
609         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
610         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
611         Fix a typo in a comment.
612
613         * dom/RadioButtonGroups.cpp: Fix a typo in a comment.
614         (WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.
615
616         * html/HTMLInputElement.cpp:
617         (WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
618         it a bit longer. Use nullptr instead of 0.
619         (WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.
620
621 2019-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
622
623         [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement()
624         https://bugs.webkit.org/show_bug.cgi?id=190620
625         <rdar://problem/19226679>
626
627         Reviewed by Ryosuke Niwa.
628
629         Fixes and re-enables an existing layout test that is asserting on debug builds (and failing on release builds).
630         To understand why we hit this assertion, we first note several observations:
631
632             -   The validity of a form control (`isValid()`) depends on the value of `willValidate()`.
633             -   Both of these results are cached in member variables: `m_isValid` and `m_willValidate`, respectively.
634             -   `willValidate()` changes the cached value of `m_willValidate` if necessary, but `isValid()` uses the
635                 cached value without update.
636
637         Now, consider the following scenario:
638
639             1.  Something changes in the DOM that changes the result of `willValidate()`. This can happen as a result of
640                 several things:
641                 a.  The form control changes readonly state
642                 b.  The form control changes disabled state
643                 c.  The form control is added to a datalist element
644                 d.  The form control is removed from a datalist element
645             2.  Call `willValidate()`.
646             3.  Call `isValid()`.
647
648         In scenarios (a) - (c), we ensure that cached form control validity (`m_isValid`) is updated alongside
649         `m_willValidate` by invoking `setNeedsWillValidateCheck()`, such that the result of `isValid()` matches the
650         result of `m_isValid` in step (3). However, in the last scenario (d), we don't do this, which causes form
651         control validity to fall out of sync with the result of `isValid()`. To fix the bug, we update willValidate and
652         isValid when a form control is removed from an ancestor, only if one of its ancestors is a datalist element.
653
654         * html/HTMLFormControlElement.cpp:
655         (WebCore::HTMLFormControlElement::insertedIntoAncestor):
656         (WebCore::HTMLFormControlElement::removedFromAncestor):
657
658         Make a couple of minor tweaks:
659           - Currently, we always invalidate `m_dataListAncestorState` by resetting the state to `Unknown` when the form
660             control is removed from an ancestor or inserted. Instead, we only need to reset it when the form control
661             already has an ancestor that is a datalist (in the case where it's being removed) or when the form control
662             does not yet have an ancestor (in the case where it is being added).
663           - If the form control was inside a datalist prior to removal, recompute its cached value of `m_willValidate`,
664             as well as its cached validity (`m_isValid`).
665
666 2019-03-01  Darin Adler  <darin@apple.com>
667
668         Finish removing String::format
669         https://bugs.webkit.org/show_bug.cgi?id=194893
670
671         Reviewed by Daniel Bates.
672
673         * dom/Document.cpp:
674         (WebCore::Document::lastModified const): Use makeString and pad.
675         * html/FTPDirectoryDocument.cpp:
676         (WebCore::processFileDateString): Ditto.
677
678         * mathml/MathMLElement.cpp:
679         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
680
681         * page/cocoa/ResourceUsageOverlayCocoa.mm:
682         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
683
684         * page/linux/ResourceUsageOverlayLinux.cpp:
685         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
686         (WebCore::gcTimerString): Use String::number.
687
688         * platform/DateComponents.cpp:
689         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
690         (WebCore::DateComponents::toString const): Ditto.
691
692         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
693         and that was also inaccurate.
694
695         * platform/audio/HRTFElevation.cpp:
696         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
697         Use makeString and pad.
698         * platform/mock/MockRealtimeVideoSource.cpp:
699         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
700         * rendering/RenderLayerCompositor.cpp:
701         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
702         * rendering/RenderTheme.cpp:
703         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
704
705 2019-03-01  Chris Dumez  <cdumez@apple.com>
706
707         Do not attempt to set WAL Journal mode on a readonly SQLite database
708         https://bugs.webkit.org/show_bug.cgi?id=195237
709
710         Reviewed by Simon Fraser.
711
712         This avoids logging errors when opening the database.
713
714         * platform/sql/SQLiteDatabase.cpp:
715         (WebCore::SQLiteDatabase::open):
716         (WebCore::SQLiteDatabase::useWALJournalMode):
717         * platform/sql/SQLiteDatabase.h:
718
719 2019-03-01  Antoine Quint  <graouts@apple.com>
720
721         [iOS] Turn mouse event simulation on by default
722         https://bugs.webkit.org/show_bug.cgi?id=195218
723         <rdar://problem/48516794>
724
725         Reviewed by Dean Jackson.
726
727         * page/RuntimeEnabledFeatures.h:
728
729 2019-03-01  Chris Dumez  <cdumez@apple.com>
730
731         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
732         https://bugs.webkit.org/show_bug.cgi?id=195230
733         <rdar://problem/47925359>
734
735         Reviewed by Ryosuke Niwa.
736
737         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
738         to address crashes on iOS WK1.
739
740         * platform/network/NetworkStateNotifier.cpp:
741         (WebCore::shouldSuppressThreadSafetyCheck):
742         (WebCore::NetworkStateNotifier::singleton):
743
744 2019-03-01  Simon Fraser  <simon.fraser@apple.com>
745
746         Show mouse event regions in the overlay
747         https://bugs.webkit.org/show_bug.cgi?id=195227
748
749         Reviewed by Tim Horton.
750
751         Enhance event region overlays to show more kinds of events.
752
753         * page/DebugPageOverlays.cpp:
754         (WebCore::touchEventRegionColors):
755         (WebCore::NonFastScrollableRegionOverlay::drawRect):
756
757 2019-03-01  Zalan Bujtas  <zalan@apple.com>
758
759         [ContentChangeObserver] Check for pending style recalcs at the end of each timer run.
760         https://bugs.webkit.org/show_bug.cgi?id=195220
761         <rdar://problem/48518979>
762
763         Reviewed by Simon Fraser.
764
765         didScheduleStyleRecalc callback was introduced to see if a style recalc is scheduled while firing the DOM timer. However it does not handle the case
766         when in addition to this style recalc scheduling, something later (though during the same timer firing) triggers a sync style recalc.
767         Let's just check if we've got a pending style recalc when the DOM timer comes back.
768
769         Test: fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html
770
771         * dom/Document.cpp:
772         (WebCore::Document::scheduleStyleRecalc):
773         * page/ios/ContentChangeObserver.cpp:
774         (WebCore::hasPendingStyleRecalc):
775         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
776         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
777         (WebCore::ContentChangeObserver::startObservingContentChanges):
778         (WebCore::ContentChangeObserver::didScheduleStyleRecalc): Deleted.
779         * page/ios/ContentChangeObserver.h:
780         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
781         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
782         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const): Deleted.
783
784 2019-03-01  John Wilander  <wilander@apple.com>
785
786         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
787         https://bugs.webkit.org/show_bug.cgi?id=195196
788         <rdar://problem/48006419>
789
790         Reviewed by Brent Fulgham.
791
792         Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
793                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
794                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
795                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
796                http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
797
798         Trackers abuse link query parameters to transport user identifiers cross-site.
799         This patch detects such navigations and applies further restrictions to
800         client-site cookies on the destination page.
801
802         * platform/network/NetworkStorageSession.cpp:
803         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
804             Now sets the regular 7-day cap and a reduced 1-day cap.
805         (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
806             Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
807             NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
808             it now clears out two types of page-specific data.
809         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
810             This function receives a cross-site navigation and checks if the originating
811             site is a prevalent resource. If so, it marks the page or stricter cookie
812             rules.
813         (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
814             Test infrastructure. This sets a state that overrides the regular per-page
815             clear of data. The reason is that the double clear was racy and caused test
816             failures.
817         (WebCore::NetworkStorageSession::clientSideCookieCap const):
818             New function that returns the current cookie lifetime cap.
819         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
820             Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().
821         * platform/network/NetworkStorageSession.h:
822         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
823         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
824             Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.
825
826 2019-03-01  Rob Buis  <rbuis@igalia.com>
827
828         Adjust XMLHttpRequest Content-Type handling
829         https://bugs.webkit.org/show_bug.cgi?id=184645
830
831         Reviewed by Youenn Fablet.
832
833         Implement steps 4.4.1.2 and 4.4.1.3 of send() [1].
834
835         Test: web-platform-tests/xhr/send-content-type-charset.htm
836
837         [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
838
839         * platform/network/ParsedContentType.cpp:
840         (WebCore::ParsedContentType::setCharset):
841         * platform/network/ParsedContentType.h:
842         * xml/XMLHttpRequest.cpp:
843         (WebCore::replaceCharsetInMediaTypeIfNeeded):
844         (WebCore::XMLHttpRequest::send):
845         (WebCore::replaceCharsetInMediaType): Deleted.
846
847 2019-03-01  Youenn Fablet  <youenn@apple.com>
848
849         Update originsMatch to handle the case of file origins which enforce file path separation
850         https://bugs.webkit.org/show_bug.cgi?id=195216
851
852         Reviewed by Brady Eidson.
853
854         Covered by the assertion and existing tests like fast/xmlhttprequest/xmlhttprequest-no-file-access.html.
855         Make sure originsMatch returns true if either compared origins are the same object
856         or they have the same file path separation behavior.
857
858         * page/SecurityOrigin.cpp:
859         (WebCore::areOriginsMatching):
860         (WebCore::originsMatch):
861
862 2019-03-01  Youenn Fablet  <youenn@apple.com>
863
864         Serialize IndexedDB::ObjectStoreOverwriteMode as an enum
865         https://bugs.webkit.org/show_bug.cgi?id=195213
866
867         Reviewed by Alex Christensen.
868
869         Add traits to enable enum IPC encoding.
870         No change of behavior.
871
872         * Modules/indexeddb/IndexedDB.h:
873
874 2019-03-01  Don Olmstead  <don.olmstead@sony.com>
875
876         [WinCairo] Enable service worker
877         https://bugs.webkit.org/show_bug.cgi?id=188318
878
879         Reviewed by Youenn Fablet.
880
881         * WebCorePrefix.h:
882         * testing/ServiceWorkerInternals.h:
883         * workers/service/context/SWContextManager.cpp:
884         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
885         * workers/service/context/SWContextManager.h:
886
887 2019-03-01  Sihui Liu  <sihui_liu@apple.com>
888
889         Add a quirk for bostongloble.com and latimes.com
890         https://bugs.webkit.org/show_bug.cgi?id=195155
891
892         Reviewed by Geoffrey Garen.
893
894         Covered by manual testing.
895
896         * Modules/webdatabase/DOMWindowWebDatabase.idl:
897         * bindings/scripts/CodeGeneratorJS.pm:
898         (GenerateRuntimeEnableConditionalString):
899         * bindings/scripts/IDLAttributes.json:
900         * bindings/scripts/preprocess-idls.pl:
901         (GenerateConstructorAttributes):
902         * page/Quirks.cpp:
903         (WebCore::Quirks::hasWebSQLSupportQuirk const):
904         * page/Quirks.h:
905
906 2019-03-01  Zalan Bujtas  <zalan@apple.com>
907
908         [ContentChangeObserver] Rename members and move implementation to header.
909         https://bugs.webkit.org/show_bug.cgi?id=195198
910         <rdar://problem/48499967>
911
912         Reviewed by Simon Fraser.
913
914         * page/ios/ContentChangeObserver.cpp:
915         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
916         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
917         (WebCore::ContentChangeObserver::startObservingStyleRecalc):
918         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
919         (WebCore::ContentChangeObserver::startObservingContentChanges):
920         (WebCore::ContentChangeObserver::stopObservingContentChanges):
921         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
922         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
923         (WebCore::ContentChangeObserver::startObservingStyleResolve): Deleted.
924         (WebCore::ContentChangeObserver::stopObservingStyleResolve): Deleted.
925         (WebCore::ContentChangeObserver::isObservingContentChanges): Deleted.
926         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
927         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
928         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling): Deleted.
929         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
930         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
931         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling): Deleted.
932         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc): Deleted.
933         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc): Deleted.
934         (WebCore::ContentChangeObserver::countOfObservedDOMTimers): Deleted.
935         (WebCore::ContentChangeObserver::clearObservedDOMTimers): Deleted.
936         (WebCore::ContentChangeObserver::containsObservedDOMTimer): Deleted.
937         * page/ios/ContentChangeObserver.h:
938         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
939         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
940         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
941         (WebCore::ContentChangeObserver::containsObservedDOMTimer const):
942         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
943         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
944         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const):
945         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
946         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const):
947         (WebCore::ContentChangeObserver::isObservingContentChanges const):
948         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const):
949         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
950
951 2019-03-01  Zalan Bujtas  <zalan@apple.com>
952
953         [ContentChangeObserver] ContentChangeObserver::StyleChangeScope should not set WKContentVisibilityChange directly
954         https://bugs.webkit.org/show_bug.cgi?id=195197
955         <rdar://problem/48498332>
956
957         Reviewed by Simon Fraser.
958
959         Add didContentVisibilityChange to hide WKContentVisibilityChange value. We might also want to add some logic to didContentVisibilityChange at some point.
960
961         * page/ios/ContentChangeObserver.cpp:
962         (WebCore::ContentChangeObserver::didContentVisibilityChange):
963         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
964         * page/ios/ContentChangeObserver.h:
965
966 2019-03-01  Jer Noble  <jer.noble@apple.com>
967
968         [EME] Make sure the hasSessionSemaphore is set even if HAVE(AVSTREAMSESSION) is false
969         https://bugs.webkit.org/show_bug.cgi?id=195217
970
971         Reviewed by Eric Carlson.
972
973         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
974         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
975
976 2019-03-01  Justin Fan  <justin_fan@apple.com>
977
978         [Web GPU] 32-bit builds broken by attempt to disable WebGPU on 32-bit
979         https://bugs.webkit.org/show_bug.cgi?id=195191
980
981         Rubber-stamped by Dean Jackson.
982
983         Dropping support for 32-bit entirely, so I'm intentionally leaving 32-bit broken.
984
985         * Configurations/FeatureDefines.xcconfig:
986
987 2019-02-28  Fujii Hironori  <Hironori.Fujii@sony.com>
988
989         HTTPSUpgradeList.db database should be opened in readonly mode
990         https://bugs.webkit.org/show_bug.cgi?id=195194
991         <rdar://problem/47103889>
992
993         Unreviewed build fix for curl.
994
995         * platform/network/curl/CookieJarDB.cpp:
996         (WebCore::CookieJarDB::openDatabase): Removed the second arguemnt of SQLiteDatabase::open.
997
998 2019-02-28  Chris Dumez  <cdumez@apple.com>
999
1000         Unreviewed Windows build fix after r242251.
1001
1002         * platform/win/SearchPopupMenuDB.cpp:
1003         (WebCore::SearchPopupMenuDB::openDatabase):
1004
1005 2019-02-28  Zalan Bujtas  <zalan@apple.com>
1006
1007         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
1008         https://bugs.webkit.org/show_bug.cgi?id=195143
1009         <rdar://problem/48462351>
1010
1011         Reviewed by Simon Fraser.
1012
1013         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
1014
1015         * page/DOMTimer.cpp:
1016         (WebCore::DOMTimer::removeById):
1017         * page/DOMWindow.cpp:
1018         (WebCore::DOMWindow::clearTimeout):
1019         * page/ios/ContentChangeObserver.cpp:
1020         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
1021         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
1022         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1023         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
1024         * page/ios/ContentChangeObserver.h:
1025
1026 2019-02-28  Chris Dumez  <cdumez@apple.com>
1027
1028         HTTPSUpgradeList.db database should be opened in readonly mode
1029         https://bugs.webkit.org/show_bug.cgi?id=195194
1030         <rdar://problem/47103889>
1031
1032         Reviewed by Youenn Fablet.
1033
1034         Add parameter to SQLiteDatabase::open() to specific the open flags.
1035
1036         * Modules/webdatabase/Database.cpp:
1037         (WebCore::Database::performOpenAndVerify):
1038         * platform/sql/SQLiteDatabase.cpp:
1039         (WebCore::SQLiteDatabase::open):
1040         * platform/sql/SQLiteDatabase.h:
1041         * platform/sql/SQLiteFileSystem.cpp:
1042         * platform/sql/SQLiteFileSystem.h:
1043
1044 2019-02-28  Brady Eidson  <beidson@apple.com>
1045
1046         Followup to:
1047         Universal links from Google search results pages don't open the app
1048         https://bugs.webkit.org/show_bug.cgi?id=195126
1049
1050         Unreviewed.
1051
1052         * page/SecurityOrigin.cpp:
1053         (WebCore::originsMatch): Remove a bogus assertion (reasoning in bugzilla)
1054
1055 2019-02-28  Simon Fraser  <simon.fraser@apple.com>
1056
1057         [iOS] Dark flash when opening Google AMP pages
1058         https://bugs.webkit.org/show_bug.cgi?id=195193
1059         rdar://problem/48326442
1060
1061         Reviewed by Zalan Bujtas.
1062
1063         After the incremental compositing updates changes, it was possible for a change in the size
1064         of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on
1065         a composited descendant that is not a descendant in z-order. When Google search results
1066         create the <iframe> that contain AMP contents, we'd fail to update a zero-sized clipping layer,
1067         leaving the #222 background of an intermediate element visible.
1068
1069         Fix by setting a flag in RenderLayer::updateLayerPosition() (which is called in containing block order)
1070         that sets the "needs geometry update" dirty bit on containing-block-descendant layers. Currently
1071         this flag affects all descendants; in future, we might be able to clear it for grand-children.
1072
1073         Tests: compositing/geometry/ancestor-clip-change-interleaved-stacking-context.html
1074                compositing/geometry/ancestor-clip-change.html
1075
1076         * rendering/RenderLayer.cpp:
1077         (WebCore::RenderLayer::updateLayerPositions):
1078         (WebCore::RenderLayer::updateLayerPosition):
1079         * rendering/RenderLayer.h:
1080         * rendering/RenderLayerBacking.cpp:
1081         (WebCore::RenderLayerBacking::updateAfterLayout):
1082         * rendering/RenderLayerBacking.h:
1083
1084 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
1085
1086         Use-after-move in RenderCombineText::combineTextIfNeeded()
1087         https://bugs.webkit.org/show_bug.cgi?id=195188
1088
1089         Reviewed by Zalan Bujtas.
1090
1091         r241288 uncovered an existing problem with our text-combine code. r242204 alleviated the
1092         symptom, but this patch fixes the source of the problem (and reverts r242204).
1093
1094         The code in RenderCombineText::combineTextIfNeeded() has a bit that’s like:
1095
1096         FontDescription bestFitDescription;
1097         while (...) {
1098             FontCascade compressedFont(WTFMove(bestFitDescription), ...);
1099             ...
1100         }
1101
1102         Clearly this is wrong.
1103
1104         Test: fast/text/text-combine-crash-2.html
1105
1106         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1107         (WebCore::FontDescription::platformResolveGenericFamily):
1108         * rendering/RenderCombineText.cpp:
1109         (WebCore::RenderCombineText::combineTextIfNeeded):
1110
1111 2019-02-28  Zalan Bujtas  <zalan@apple.com>
1112
1113         [ContentChangeObserver] Introduce observer subclasses to scope content change observing.
1114         https://bugs.webkit.org/show_bug.cgi?id=195172
1115         <rdar://problem/48479259>
1116
1117         Reviewed by Simon Fraser.
1118
1119         Let's scope start/stopObserving call pairs.
1120
1121         * dom/Document.cpp:
1122         (WebCore::Document::updateStyleIfNeeded):
1123         * page/DOMTimer.cpp:
1124         (WebCore::DOMTimer::fired):
1125         * page/ios/ContentChangeObserver.cpp:
1126         (WebCore::ContentChangeObserver::StyleChangeObserver::StyleChangeObserver):
1127         (WebCore::ContentChangeObserver::StyleChangeObserver::~StyleChangeObserver):
1128         (WebCore::ContentChangeObserver::StyleRecalcObserver::StyleRecalcObserver):
1129         (WebCore::ContentChangeObserver::StyleRecalcObserver::~StyleRecalcObserver):
1130         (WebCore::ContentChangeObserver::DOMTimerObserver::DOMTimerObserver):
1131         (WebCore::ContentChangeObserver::DOMTimerObserver::~DOMTimerObserver):
1132         (WebCore::ContentChangeObserver::StyleChange::StyleChange): Deleted.
1133         (WebCore::ContentChangeObserver::StyleChange::~StyleChange): Deleted.
1134         * page/ios/ContentChangeObserver.h:
1135         * rendering/updating/RenderTreeUpdater.cpp:
1136         (WebCore::RenderTreeUpdater::updateElementRenderer):
1137
1138 2019-02-28  Antoine Quint  <graouts@apple.com>
1139
1140         Enable the Pointer Events runtime flag by default
1141         https://bugs.webkit.org/show_bug.cgi?id=195156
1142
1143         Reviewed by Dean Jackson.
1144
1145         * page/RuntimeEnabledFeatures.h:
1146
1147 2019-02-28  Zalan Bujtas  <zalan@apple.com>
1148
1149         [ContentChangeObserver] Make observed state reset explicit.
1150         https://bugs.webkit.org/show_bug.cgi?id=195185
1151         <rdar://problem/48488342>
1152
1153         Reviewed by Simon Fraser.
1154
1155         Use setObservedContentChange only for setting the observed change while observing.
1156
1157         * page/ios/ContentChangeObserver.cpp:
1158         (WebCore::ContentChangeObserver::startObservingContentChanges):
1159         (WebCore::ContentChangeObserver::resetObservedContentChange):
1160         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1161         * page/ios/ContentChangeObserver.h:
1162
1163 2019-02-28  Commit Queue  <commit-queue@webkit.org>
1164
1165         Unreviewed, rolling out r242210.
1166         https://bugs.webkit.org/show_bug.cgi?id=195179
1167
1168         it broke hover menus on losaltosonline.com (Requested by zalan
1169         on #webkit).
1170
1171         Reverted changeset:
1172
1173         "[ContentChangeObserver] Move timer removal code from
1174         DOMWindow::clearTimeout to DOMTimer::removeById"
1175         https://bugs.webkit.org/show_bug.cgi?id=195143
1176         https://trac.webkit.org/changeset/242210
1177
1178 2019-02-28  Zalan Bujtas  <zalan@apple.com>
1179
1180         [ContentChangeObserver] Move timer removal code from DOMWindow::clearTimeout to DOMTimer::removeById
1181         https://bugs.webkit.org/show_bug.cgi?id=195143
1182         <rdar://problem/48462351>
1183
1184         Reviewed by Simon Fraser.
1185
1186         Currently DOMWindow::clearTimeout() is the only callsite that we are interested in, but this is more future-proof.
1187
1188         * page/DOMTimer.cpp:
1189         (WebCore::DOMTimer::removeById):
1190         * page/DOMWindow.cpp:
1191         (WebCore::DOMWindow::clearTimeout):
1192         * page/ios/ContentChangeObserver.cpp:
1193         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
1194         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
1195         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1196         (WebCore::ContentChangeObserver::removeDOMTimer): Deleted.
1197         * page/ios/ContentChangeObserver.h:
1198
1199 2019-02-28  Charles Vazac  <cvazac@akamai.com>
1200
1201         Fix Resource Timing buffer edge cases for WPT
1202         https://bugs.webkit.org/show_bug.cgi?id=193213
1203
1204         Reviewed by Youenn Fablet.
1205
1206         Test coverage by LayoutTests/imported/w3c/web-platform-tests/resource-timing/buffer*.html
1207
1208         * page/Performance.cpp:
1209         (WebCore::Performance::resourceTimingBufferFullTimerFired): Only dispatch the
1210         resourcetimingbufferfull event if the buffer is still full (as it may have been cleared or
1211         expanded). Also, avoid infinite loops if we aren't able to decrease the number of entries in
1212         the secondary buffer.
1213
1214 2019-02-28  Takashi Komori  <Takashi.Komori@sony.com>
1215
1216         [Curl] HTTP Body is missing with redirection.
1217         https://bugs.webkit.org/show_bug.cgi?id=191651
1218
1219         Reviewed by Don Olmstead.
1220
1221         Implement updateFromDelegatePreservingOldProperties for curl port.
1222
1223         Tests: http/tests/navigation/post-301-response.html
1224                http/tests/navigation/post-302-response.html
1225                http/tests/navigation/post-303-response.html
1226                http/tests/navigation/post-307-response.html
1227                http/tests/navigation/post-308-response.html
1228
1229         * platform/Curl.cmake:
1230         * platform/network/curl/ResourceRequest.h:
1231         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties): Deleted.
1232         * platform/network/curl/ResourceRequestCurl.cpp: Added.
1233         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
1234
1235 2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
1236
1237         [CoordinatedGraphics] Remove COORDINATED_GRAPHICS_THREADED option
1238         https://bugs.webkit.org/show_bug.cgi?id=195159
1239
1240         Reviewed by Don Olmstead.
1241
1242         Use COORDINATED_GRAPHICS instead.
1243
1244         * platform/graphics/GraphicsContext3D.h:
1245         * platform/graphics/PlatformLayer.h:
1246         * platform/graphics/cairo/ImageBufferCairo.cpp:
1247         (WebCore::ImageBufferData::ImageBufferData):
1248         (WebCore::ImageBufferData::~ImageBufferData):
1249         * platform/graphics/cairo/ImageBufferDataCairo.h:
1250         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
1251         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
1252         * platform/graphics/nicosia/texmap/NicosiaGC3DLayer.cpp:
1253         (Nicosia::GC3DLayer::swapBuffersIfNeeded):
1254         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1255         (WebCore::GraphicsContext3D::reshapeFBOs):
1256         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1257         (WebCore::GraphicsContext3D::prepareTexture):
1258         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1259         (WebCore::GraphicsContext3D::reshapeFBOs):
1260         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
1261         (WebCore::GraphicsContext3D::GraphicsContext3D):
1262         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1263         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
1264         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
1265         (WebCore::TextureMapperGC3DPlatformLayer::~TextureMapperGC3DPlatformLayer):
1266         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
1267         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
1268         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
1269         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1270         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1271         * platform/graphics/texmap/TextureMapperPlatformLayerProxyProvider.h:
1272         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1273         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
1274         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
1275         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
1276         * rendering/RenderLayerBacking.cpp:
1277         (WebCore::RenderLayerBacking::paintsIntoWindow const):
1278         * rendering/RenderLayerCompositor.cpp:
1279         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
1280
1281 2019-02-28  Myles C. Maxfield  <mmaxfield@apple.com>
1282
1283         Locale names can be nullptr
1284         https://bugs.webkit.org/show_bug.cgi?id=195171
1285         <rdar://problem/48262376>
1286
1287         Reviewed by Dean Jackson.
1288
1289         Nullptr can't be used in keys to HashMaps, so take an early out in this case.
1290
1291         This is a partial revert of r241288.
1292
1293         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1294         (WebCore::FontDescription::platformResolveGenericFamily):
1295
1296 2019-02-28  Justin Fan  <justin_fan@apple.com>
1297
1298         [Web GPU] Enable Web GPU only on 64-bit
1299         https://bugs.webkit.org/show_bug.cgi?id=195139
1300
1301         Because Metal is only supported on 64 bit apps.
1302
1303         Unreviewed build fix.
1304
1305         * Configurations/FeatureDefines.xcconfig:
1306
1307 2019-02-27  Zalan Bujtas  <zalan@apple.com>
1308
1309         [ContentChangeObserver] Move WKSetObservedContentChange logic to ContentChangeObserver class.
1310         https://bugs.webkit.org/show_bug.cgi?id=195128
1311         <rdar://problem/48456752>
1312
1313         Reviewed by Simon Fraser.
1314
1315         Move the final bits over to ContentChangeObserver and delete WKContentObservationInternal.h.
1316
1317         * WebCore.xcodeproj/project.pbxproj:
1318         * page/ios/ContentChangeObserver.mm:
1319         (WebCore::ContentChangeObserver::setObservedContentChange):
1320         * platform/ios/wak/WKContentObservation.cpp:
1321         (WKSetObservedContentChange):
1322         * platform/ios/wak/WKContentObservation.h:
1323         * platform/ios/wak/WKContentObservationInternal.h: Removed.
1324
1325 2019-02-27  Simon Fraser  <simon.fraser@apple.com>
1326
1327         Roll out r242014; it caused crashes in compositing logging (webkit.org/b/195141)
1328
1329         * dom/Document.cpp:
1330         (WebCore::Document::lastModified const):
1331         * html/FTPDirectoryDocument.cpp:
1332         (WebCore::processFileDateString):
1333         * mathml/MathMLElement.cpp:
1334         (WebCore::convertToPercentageIfNeeded):
1335         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
1336         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1337         (WebCore::ResourceUsageOverlay::platformDraw):
1338         * page/linux/ResourceUsageOverlayLinux.cpp:
1339         (WebCore::cpuUsageString):
1340         (WebCore::gcTimerString):
1341         * platform/DateComponents.cpp:
1342         (WebCore::DateComponents::toStringForTime const):
1343         (WebCore::DateComponents::toString const):
1344         * platform/LocalizedStrings.cpp:
1345         (WebCore::localizedString):
1346         * platform/audio/HRTFElevation.cpp:
1347         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1348         * platform/mock/MockRealtimeVideoSource.cpp:
1349         (WebCore::MockRealtimeVideoSource::drawText):
1350         * rendering/RenderLayerCompositor.cpp:
1351         (WebCore::RenderLayerCompositor::logLayerInfo):
1352         * rendering/RenderTheme.cpp:
1353         (WebCore::RenderTheme::formatMediaControlsTime const):
1354
1355 2019-02-27  Zalan Bujtas  <zalan@apple.com>
1356
1357         [ContentChangeObserver] Move _WKObservingContentChanges from global to ContentChangeObserver class
1358         https://bugs.webkit.org/show_bug.cgi?id=195091
1359         <rdar://problem/48427271>
1360
1361         Reviewed by Tim Horton.
1362
1363         * page/ios/ContentChangeObserver.h:
1364         * page/ios/ContentChangeObserver.mm:
1365         (WebCore::ContentChangeObserver::startObservingContentChanges):
1366         (WebCore::ContentChangeObserver::stopObservingContentChanges):
1367         (WebCore::ContentChangeObserver::isObservingContentChanges):
1368         * platform/ios/wak/WKContentObservation.cpp:
1369         (WKObservingContentChanges): Deleted.
1370         (WKStartObservingContentChanges): Deleted.
1371         (WKStopObservingContentChanges): Deleted.
1372         * platform/ios/wak/WKContentObservation.h:
1373         * platform/ios/wak/WKContentObservationInternal.h:
1374
1375 2019-02-27  Brady Eidson  <beidson@apple.com>
1376
1377         Universal links from Google search results pages don't open the app.
1378         <rdar://problem/46887179> and https://bugs.webkit.org/show_bug.cgi?id=195126
1379
1380         Reviewed by Geoffrey Garen.
1381
1382         Covered by new API tests.
1383
1384         * loader/DocumentLoader.cpp:
1385         (WebCore::DocumentLoader::shouldOpenExternalURLsPolicyToPropagate const): Propagate the external URL policy from
1386           an iframe if it is from the same security origin as the main frame.
1387
1388 2019-02-27  Zalan Bujtas  <zalan@apple.com>
1389
1390         [ContentChangeObserver] Move DOMTimer schedule handling from global to ContentChangeObserver class
1391         https://bugs.webkit.org/show_bug.cgi?id=195090
1392         <rdar://problem/48426771>
1393
1394         Reviewed by Tim Horton.
1395
1396         Also remove some unused functions from WKContentObservationInternal.
1397
1398         * page/ios/ContentChangeObserver.h:
1399         * page/ios/ContentChangeObserver.mm:
1400         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
1401         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling):
1402         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling):
1403         * platform/ios/wak/WKContentObservation.cpp:
1404         (WKStartObservingDOMTimerScheduling): Deleted.
1405         (WKStopObservingDOMTimerScheduling): Deleted.
1406         (WKIsObservingDOMTimerScheduling): Deleted.
1407         * platform/ios/wak/WKContentObservation.h:
1408         * platform/ios/wak/WKContentObservationInternal.h:
1409
1410 2019-02-27  Zalan Bujtas  <zalan@apple.com>
1411
1412         [ContentChangeObserver] Move style recalc handling from global to ContentChangeObserver class
1413         https://bugs.webkit.org/show_bug.cgi?id=195087
1414
1415         Reviewed by Simon Fraser.
1416
1417         Add m_observingNextStyleRecalc/m_observingStyleRecalcScheduling to ContentChangeObserver and move the related code over from WK functions.
1418
1419         * page/ios/ContentChangeObserver.h:
1420         * page/ios/ContentChangeObserver.mm:
1421         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling):
1422         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling):
1423         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling):
1424         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1425         (WebCore::ContentChangeObserver::shouldObserveNextStyleRecalc):
1426         (WebCore::ContentChangeObserver::setObservedContentChange):
1427         * platform/ios/wak/WKContentObservation.cpp:
1428         (WKSetObservedContentChange):
1429         (WKStartObservingStyleRecalcScheduling): Deleted.
1430         (WKStopObservingStyleRecalcScheduling): Deleted.
1431         (WKIsObservingStyleRecalcScheduling): Deleted.
1432         (WKSetShouldObserveNextStyleRecalc): Deleted.
1433         (WKShouldObserveNextStyleRecalc): Deleted.
1434         * platform/ios/wak/WKContentObservation.h:
1435
1436 2019-02-27  Zalan Bujtas  <zalan@apple.com>
1437
1438         [ContentChangeObserver] Move DOM timer handling from global to ContentChangeObserver class
1439         https://bugs.webkit.org/show_bug.cgi?id=195070
1440         <rdar://problem/48417650>
1441
1442         Reviewed by Tim Horton.
1443
1444         Add DOM timer list to ContentChangeObserver and move the related code over from WK functions.
1445
1446         * page/ios/ContentChangeObserver.h:
1447         * page/ios/ContentChangeObserver.mm:
1448         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling):
1449         (WebCore::ContentChangeObserver::countOfObservedDOMTimers):
1450         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
1451         (WebCore::ContentChangeObserver::setObservedContentChange):
1452         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
1453         (WebCore::ContentChangeObserver::addObservedDOMTimer):
1454         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
1455         * platform/ios/wak/WKContentObservation.cpp:
1456         (WKStartObservingDOMTimerScheduling):
1457         (WKSetObservedContentChange):
1458         (WebThreadGetObservedDOMTimers): Deleted.
1459         (WebThreadCountOfObservedDOMTimers): Deleted.
1460         (WebThreadClearObservedDOMTimers): Deleted.
1461         (WebThreadContainsObservedDOMTimer): Deleted.
1462         (WebThreadAddObservedDOMTimer): Deleted.
1463         (WebThreadRemoveObservedDOMTimer): Deleted.
1464         * platform/ios/wak/WKContentObservation.h:
1465
1466 2019-02-27  Justin Fan  <justin_fan@apple.com>
1467         Fix build errors after Web GPU buffer updates changed some IDL fields from unsigned long to unsigned long long.
1468
1469         Unreviewed build fix.
1470
1471         * Modules/webgpu/WebGPUBuffer.cpp:
1472         (WebCore::WebGPUBuffer::setSubData):
1473         * Modules/webgpu/WebGPUBuffer.h:
1474         * Modules/webgpu/WebGPUBufferBinding.h:
1475         * Modules/webgpu/WebGPURenderPassEncoder.idl:
1476         * platform/graphics/gpu/GPUBufferBinding.h:
1477         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
1478         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
1479
1480 2019-02-27  John Wilander  <wilander@apple.com>
1481
1482         Adopt WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics and WebKit::NetworkProcessProxy
1483         https://bugs.webkit.org/show_bug.cgi?id=195071
1484         <rdar://problem/48417690>
1485
1486         Reviewed by Alex Christensen and Brent Fulgham.
1487
1488         No new tests. This patch maintains functionality covered by plenty of layout
1489         tests under http/tests/resourceLoadStatistics/ and http/tests/storageAccess.
1490
1491         This patch adopts WebCore::RegistrableDomain in WebCore::ResourceLoadStatistics
1492         and makes the necessary infrastructure changes to support that.
1493
1494         The previous HashCountedSets in WebCore::ResourceLoadStatistics are now just
1495         HashSets since we never used the counts for anything. This change simplified
1496         encoding and decoding for IPC and will eventually simplify encoding and
1497         decoding in loader/ResourceLoadStatistics.cpp when we obsolete statistics
1498         model version 14 and below.
1499
1500         The patch also makes WebCore::RegistrableDomain's String constructor private.
1501         A new create function WebCore::RegistrableDomain::uncheckedCreateFromString()
1502         is introduced to better signal to users that creating a registrable domain
1503         object with a string may create an object that doesn't match a registrable
1504         domain in a valid HTTP-family URL. This change (private String constructor)
1505         motivated a change in WebCore::AdClickAttribution where the Source and
1506         Destination structs now take a URL as parameter instead of a String.
1507
1508         Finally, this patch harmonizes parameter and variable naming, going from
1509         "origin" to "domain" and "mainFrame" to "topFrame."
1510
1511         * html/HTMLAnchorElement.cpp:
1512         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
1513         * html/HTMLMediaElement.cpp:
1514         (WebCore::HTMLMediaElement::mediaSessionTitle const):
1515         * loader/AdClickAttribution.h:
1516         (WebCore::AdClickAttribution::Source::Source):
1517         (WebCore::AdClickAttribution::Source::deletedValue):
1518         (WebCore::AdClickAttribution::Destination::Destination):
1519         (WebCore::AdClickAttribution::Destination::deletedValue):
1520         (WebCore::AdClickAttribution::decode):
1521         * loader/ResourceLoadObserver.cpp:
1522         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1523         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1524         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1525         (WebCore::ResourceLoadObserver::statisticsForURL):
1526         (WebCore::ResourceLoadObserver::statisticsForOrigin): Deleted.
1527         * loader/ResourceLoadObserver.h:
1528         * loader/ResourceLoadStatistics.cpp:
1529         (WebCore::encodeHashSet):
1530         (WebCore::ResourceLoadStatistics::encode const):
1531         (WebCore::decodeHashCountedSet):
1532         (WebCore::decodeHashSet):
1533         (WebCore::ResourceLoadStatistics::decode):
1534         (WebCore::appendHashSet):
1535         (WebCore::ResourceLoadStatistics::toString const):
1536         (WebCore::ResourceLoadStatistics::merge):
1537         (WebCore::encodeHashCountedSet): Deleted.
1538         (WebCore::encodeOriginHashSet): Deleted.
1539         (WebCore::decodeOriginHashSet): Deleted.
1540         (WebCore::appendHashCountedSet): Deleted.
1541         * loader/ResourceLoadStatistics.h:
1542         * platform/RegistrableDomain.h:
1543         (WebCore::RegistrableDomain::uncheckedCreateFromString):
1544         (WebCore::RegistrableDomain::RegistrableDomain):
1545         * testing/Internals.cpp:
1546         (WebCore::Internals::resourceLoadStatisticsForURL):
1547         (WebCore::Internals::resourceLoadStatisticsForOrigin): Deleted.
1548         * testing/Internals.h:
1549         * testing/Internals.idl:
1550
1551 2019-02-27  Justin Fan  <justin_fan@apple.com>
1552
1553         [Web GPU] Buffer updates part 2: setSubData, GPU/CPU synchronization
1554         https://bugs.webkit.org/show_bug.cgi?id=195077
1555         <rdar://problem/47805229>
1556
1557         Reviewed by Dean Jackson.
1558
1559         Implement GPUBuffer.setSubData and prevent the resolving of mapping promises if the buffer is scheduled to be 
1560         used on the GPU, and add handlers to resolve such promises after command buffer execution completes. In addition,
1561         update buffer sizes to u64 (unsigned long in C++) as per the updated Web GPU API.
1562
1563         Tests: webgpu/buffer-command-buffer-races.html
1564                webgpu/map-read-buffers.html
1565
1566         * Modules/webgpu/WebGPUBindGroup.h:
1567         (WebCore::WebGPUBindGroup::bindGroup const):
1568         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
1569         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Rename binding -> bufferBinding to reduce confusion.
1570         * Modules/webgpu/WebGPUBuffer.cpp: Small tweaks.
1571         (WebCore::WebGPUBuffer::setSubData):
1572         (WebCore::WebGPUBuffer::unmap): Correctly fail if buffer is destroyed.
1573         (WebCore::WebGPUBuffer::destroy):
1574         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
1575         * Modules/webgpu/WebGPUBuffer.h:
1576         (WebCore::WebGPUBuffer::buffer const): Returned buffer is no longer const so that it can be used in completed handler callbacks.
1577         * Modules/webgpu/WebGPUBuffer.idl: Enable setSubData.
1578         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1579         (WebCore::WebGPUCommandBuffer::beginRenderPass):
1580         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
1581         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
1582         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
1583         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
1584         (WebCore::WebGPURenderPassEncoder::setVertexBuffers):
1585         * Sources.txt:
1586         * WebCore.xcodeproj/project.pbxproj:
1587         * platform/graphics/gpu/GPUBuffer.h:
1588         (WebCore::GPUBuffer::isTransferDst const): Added various state and flag getters.
1589         (WebCore::GPUBuffer::isVertex const):
1590         (WebCore::GPUBuffer::isUniform const):
1591         (WebCore::GPUBuffer::isStorage const):
1592         (WebCore::GPUBuffer::isReadOnly const):
1593         (WebCore::GPUBuffer::isMappable const):
1594         (WebCore::GPUBuffer::isMapWrite const):
1595         (WebCore::GPUBuffer::isMapRead const):
1596         (WebCore::GPUBuffer::isMapWriteable const):
1597         (WebCore::GPUBuffer::isMapReadable const):
1598         * platform/graphics/gpu/GPUBufferBinding.h:
1599         * platform/graphics/gpu/GPUCommandBuffer.h:
1600         (WebCore::GPUCommandBuffer::usedBuffers const):
1601         (WebCore::GPUCommandBuffer::useBuffer):
1602         * platform/graphics/gpu/GPUDevice.cpp:
1603         (WebCore::GPUDevice::tryCreateBuffer): Pass Ref of itself for Buffer to request the Queue later, if needed.
1604         (WebCore::GPUDevice::tryCreateBuffer const): Deleted.
1605         * platform/graphics/gpu/GPUDevice.h:
1606         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp: Retain the encoder's commandBuffer to reference its used resource buffers.
1607         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
1608         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1609         (WebCore::GPUProgrammablePassEncoder::commandBuffer const):
1610         * platform/graphics/gpu/GPURenderPassEncoder.h:
1611         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
1612         (WebCore::GPUBuffer::validateBufferCreate): Move validation out of tryCreate.
1613         (WebCore::GPUBuffer::tryCreate): Create both shared and private buffers, depending on usage.
1614         (WebCore::GPUBuffer::GPUBuffer):
1615         (WebCore::GPUBuffer::~GPUBuffer): Call destroy instead of just unmap.
1616         (WebCore::GPUBuffer::state const):
1617         (WebCore::GPUBuffer::setSubData): Uses a cached collection of staging MTLBuffers to encode data copies to the implementation MTLBuffer.
1618         (WebCore::GPUBuffer::commandBufferCommitted): Register on the GPUBuffer that the provided MTLCommandBuffer uses it, and is about to be committed.
1619         (WebCore::GPUBuffer::commandBufferCompleted): MTLCommandBuffer's onCompletedHandler calls this.
1620         (WebCore::GPUBuffer::reuseSubDataBuffer): SetSubData's blit command buffers call this to return a staging buffer to the pool.
1621         (WebCore::GPUBuffer::registerMappingCallback):
1622         (WebCore::GPUBuffer::runMappingCallback):
1623         (WebCore::GPUBuffer::unmap):
1624         (WebCore::GPUBuffer::destroy):
1625         (WebCore::GPUBuffer::tryCreateSharedBuffer): Deleted.
1626         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1627         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
1628         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
1629         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1630         (WebCore::GPUQueue::submit): Ensure submitted buffers are in the correct state, and add completed handlers for synchronization.
1631         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1632         (WebCore::GPURenderPassEncoder::tryCreate):
1633         (WebCore::GPURenderPassEncoder::GPURenderPassEncoder): Retain the commandBuffer for later reference.
1634         (WebCore::GPURenderPassEncoder::setVertexBuffers): Mark vertex buffers as used before submission.
1635         (WebCore::GPURenderPassEncoder::create): Deleted.
1636
1637         Buffer size updates in the IDL:
1638         * Modules/webgpu/GPUBufferDescriptor.idl:
1639         * Modules/webgpu/WebGPUBuffer.idl:
1640         * Modules/webgpu/WebGPUBufferBinding.idl:
1641         * Modules/webgpu/WebGPUCommandBuffer.idl:
1642         * Modules/webgpu/WebGPURenderPassEncoder.idl:
1643         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl:
1644         * Modules/webgpu/WebGPUVertexInputDescriptor.idl:
1645
1646 2019-02-27  Youenn Fablet  <youenn@apple.com>
1647
1648         Remove LeetCode FetchRequest quirk
1649         https://bugs.webkit.org/show_bug.cgi?id=195100
1650
1651         Reviewed by Alex Christensen.
1652
1653         Covered by manual testing.
1654
1655         * Modules/fetch/FetchRequest.cpp:
1656         (WebCore::needsSignalQuirk):
1657
1658 2019-02-27  Chris Dumez  <cdumez@apple.com>
1659
1660         Unable to log into chase.com on iPad when DeviceMotionEvent API is disabled
1661         https://bugs.webkit.org/show_bug.cgi?id=195101
1662         <rdar://problem/48423023>
1663
1664         Reviewed by Geoffrey Garen.
1665
1666         Add site-specific quirk for chase.com on iOS where we fire a dummy DeviceMotionEvent if the page
1667         tries to register a "devicemotion" event listener and fails because the API is disabled. This is
1668         needed to unblock the site and proceed with the login flow.
1669
1670         Unfortunately, document()->settings().needsSiteSpecificQuirks() is false on iOS so I could not
1671         guard the quirk behind this flag.
1672
1673         * page/DOMWindow.cpp:
1674         (WebCore::DOMWindow::addEventListener):
1675         (WebCore::DOMWindow::failedToRegisterDeviceMotionEventListener):
1676         * page/DOMWindow.h:
1677
1678 2019-02-27  Antoine Quint  <graouts@apple.com>
1679
1680         Support Pointer Events on macOS
1681         https://bugs.webkit.org/show_bug.cgi?id=195008
1682         <rdar://problem/47454419>
1683
1684         Reviewed by Dean Jackson.
1685
1686         We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
1687         a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
1688         exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
1689         and the same behavior also extends to "pointerup".
1690
1691         Tests: pointerevents/mouse/over-enter-out-leave.html
1692                pointerevents/mouse/pointer-capture.html
1693                pointerevents/mouse/pointer-event-basic-properties.html
1694                pointerevents/mouse/pointer-events-before-mouse-events.html
1695                pointerevents/mouse/pointerdown-prevent-default.html
1696
1697         * Configurations/FeatureDefines.xcconfig:
1698         * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
1699         property does not have any effect on macOS.
1700         (WebCore::Document::invalidateRenderingDependentRegions):
1701         (WebCore::Document::nodeWillBeRemoved):
1702         (WebCore::Document::updateTouchActionElements):
1703         * dom/Document.h:
1704         * dom/Element.cpp:
1705         (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
1706         If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
1707         the mouse event.
1708         * dom/PointerEvent.cpp:
1709         (WebCore::pointerEventType):
1710         (WebCore::PointerEvent::create):
1711         * dom/PointerEvent.h:
1712         * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
1713         (WebCore::hierarchyHasCapturingEventListeners):
1714         (WebCore::EventHandler::updateMouseEventTargetNode):
1715         * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
1716         (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
1717         (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
1718         pending target override needs to be considered to determine whether a given element has pointer capture enabled.
1719         (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
1720         it is set.
1721         * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
1722         * style/StyleTreeResolver.cpp:
1723         (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
1724
1725 2019-02-27  Sihui Liu  <sihui_liu@apple.com>
1726
1727         Network Process is put to suspended when holding locked IndexedDB files
1728         https://bugs.webkit.org/show_bug.cgi?id=195024
1729         <rdar://problem/45194169>
1730
1731         Reviewed by Geoffrey Garen.
1732
1733         We found network process was suspended when IDBDatabase was being closed in the background database thread, 
1734         holding locks to its database file. To avoid starvation or deadlock, we need to keep network process alive by 
1735         taking background assertion in UI process until the closes are done and locks are released.
1736
1737         * Modules/indexeddb/server/IDBServer.cpp:
1738         (WebCore::IDBServer::IDBServer::create):
1739         (WebCore::IDBServer::IDBServer::IDBServer):
1740         (WebCore::IDBServer::IDBServer::createBackingStore):
1741         (WebCore::IDBServer::IDBServer::closeDatabase):
1742         (WebCore::IDBServer::IDBServer::didCloseDatabase):
1743         * Modules/indexeddb/server/IDBServer.h:
1744         (WebCore::IDBServer::IDBServer::create):
1745         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1746         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
1747         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
1748         (WebCore::IDBServer::UniqueIDBDatabase::didShutdownForClose):
1749         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
1750         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
1751         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
1752         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1753
1754 2019-02-26  Simon Fraser  <simon.fraser@apple.com>
1755
1756         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
1757         https://bugs.webkit.org/show_bug.cgi?id=194973
1758
1759         Reviewed by Antti Koivisto.
1760
1761         This patch cleans up how the scrolling tree responds to scrolls.
1762
1763         First, ScrollingTreeScrollingNode::m_currentScrollPosition is "truth" for scrolling thread/
1764         UI process scroll position.
1765
1766         On macOS where handleWheelEvent on the scrolling thread changes scroll position, the
1767         bottleneck is ScrollingTreeScrollingNode::scrollTo() which sets the new scroll position,
1768         update the visual viewport (for frame scrolls) updates the scrolledContentsLayer position,
1769         updates related layers on this node (counter-scrolling layers etc), and then tells the
1770         scrolling tree, which recurses through descendant nodes so they can adjust their layer
1771         positions.
1772
1773         On iOS, the bottleneck is ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(),
1774         which does the above other than setting scrolledContentsLayer (since we're reacting to
1775         layer state changes, not producing them).
1776
1777         updateLayersAfterAncestorChange() is renamed to relatedNodeScrollPositionDidChange(), and
1778         ScrollingTree does the tree walk so classes don't have to implement
1779         updateLayersAfterAncestorChange() just to talk children. The ScrollingTree tree walk knows
1780         how to get the correct layoutViewport and to stop at frame boundaries (layer updates never
1781         need to cross frame boundaries).
1782
1783         We preserve 'cumulativeDelta'; it's necessary for things like fixed inside overflow:scroll,
1784         since the fixed state was computed with the "layout" scroll position, so we have to account
1785         for the scroll delta since the last committed position. It's possible we could improve this
1786         in future.
1787
1788         * page/scrolling/ScrollingTree.cpp:
1789         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
1790         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
1791         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
1792         (WebCore::ScrollingTree::mainFrameLayoutViewport):
1793         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): Deleted.
1794         * page/scrolling/ScrollingTree.h:
1795         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
1796         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange): Deleted.
1797         * page/scrolling/ScrollingTreeFrameHostingNode.h:
1798         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1799         (WebCore::ScrollingTreeFrameScrollingNode::updateViewportForCurrentScrollPosition):
1800         (WebCore::ScrollingTreeFrameScrollingNode::localToContentsPoint const):
1801         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1802         * page/scrolling/ScrollingTreeNode.cpp:
1803         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
1804         (WebCore::ScrollingTreeNode::enclosingScrollingNodeIncludingSelf):
1805         * page/scrolling/ScrollingTreeNode.h:
1806         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1807         (WebCore::ScrollingTreeScrollingNode::minimumScrollPosition const):
1808         (WebCore::ScrollingTreeScrollingNode::scrollLimitReached const):
1809         (WebCore::ScrollingTreeScrollingNode::adjustedScrollPosition const):
1810         (WebCore::ScrollingTreeScrollingNode::scrollBy):
1811         (WebCore::ScrollingTreeScrollingNode::scrollTo):
1812         (WebCore::ScrollingTreeScrollingNode::currentScrollPositionChanged):
1813         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
1814         (WebCore::ScrollingTreeScrollingNode::localToContentsPoint const):
1815         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange): Deleted.
1816         (WebCore::ScrollingTreeScrollingNode::setScrollPosition): Deleted.
1817         * page/scrolling/ScrollingTreeScrollingNode.h:
1818         * page/scrolling/ScrollingTreeScrollingNodeDelegate.h:
1819         (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const):
1820         (WebCore::ScrollingTreeScrollingNodeDelegate::scrollPosition const): Deleted.
1821         * page/scrolling/ThreadedScrollingTree.cpp:
1822         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1823         * page/scrolling/ThreadedScrollingTree.h:
1824         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
1825         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
1826         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
1827         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): Deleted.
1828         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
1829         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
1830         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
1831         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): Deleted.
1832         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1833         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1834         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1835         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
1836         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1837         (WebCore::ScrollingTreeFrameScrollingNodeMac::adjustedScrollPosition const):
1838         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
1839         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
1840         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
1841         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
1842         (WebCore::ScrollingTreeFrameScrollingNodeMac::exposedUnfilledArea const):
1843         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
1844         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition): Deleted.
1845         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition): Deleted.
1846         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateLayersAfterViewportChange): Deleted.
1847         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1848         (): Deleted.
1849         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1850         (WebCore::ScrollingTreeOverflowScrollingNodeMac::adjustedScrollPosition const):
1851         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
1852         (WebCore::ScrollingTreeOverflowScrollingNodeMac::~ScrollingTreeOverflowScrollingNodeMac): Deleted.
1853         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange): Deleted.
1854         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
1855         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition): Deleted.
1856         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition): Deleted.
1857         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll): Deleted.
1858         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1859         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture):
1860         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
1861         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection):
1862         (WebCore::ScrollingTreeScrollingNodeDelegateMac::adjustScrollPositionToBoundsIfNecessary):
1863         (WebCore::ScrollingTreeScrollingNodeDelegateMac::scrollOffset const):
1864         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollOnAxis):
1865
1866 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
1867
1868         Have a single notion of scroll position in the scrolling tree and derive layoutViewport from it
1869         https://bugs.webkit.org/show_bug.cgi?id=194973
1870
1871         Reviewed by Antti Koivisto.
1872
1873         The "master" value for the scroll position of a ScrollingTreeScrollingNode is now its m_scrollPosition member;
1874         layout viewports and layer positions will be set from this. This allows scrollPosition() to no longer be virtual
1875         and require different code for each scrolling node subclass, and adds a choke point that we can use to update
1876         the layout viewport.
1877         
1878         We can remove m_probableMainThreadScrollPosition on ScrollingTreeFrameScrollingNodeMac because this was really just
1879         an alias for the scroll position.
1880
1881         Add some isRootNode() checks for things that should only affect the main frame.
1882
1883         * page/scrolling/ScrollingTree.h: Remove fixedPositionRect() which was unused, and is a per-frame thing so makes
1884         no sense here.
1885         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1886         (WebCore::ScrollingTreeFrameScrollingNode::didChangeScrollPosition):
1887         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1888         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport const):
1889         (WebCore::ScrollingTreeFrameScrollingNode::setLayoutViewport):
1890         (WebCore::ScrollingTreeFrameScrollingNode::fixedPositionRect): Deleted.
1891         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1892         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
1893         (WebCore::ScrollingTreeScrollingNode::setScrollPositionInternal):
1894         (WebCore::ScrollingTreeScrollingNode::didChangeScrollPosition):
1895         * page/scrolling/ScrollingTreeScrollingNode.h:
1896         (WebCore::ScrollingTreeScrollingNode::scrollPosition const):
1897         * page/scrolling/ios/ScrollingTreeIOS.cpp:
1898         (WebCore::ScrollingTreeIOS::fixedPositionRect): Deleted.
1899         * page/scrolling/ios/ScrollingTreeIOS.h:
1900         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1901         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1902         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1903         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
1904         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
1905         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
1906         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState):
1907         (WebCore::ScrollingTreeFrameScrollingNodeMac::scrollPosition const): Deleted.
1908         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
1909         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
1910         (WebCore::ScrollingTreeOverflowScrollingNodeMac::scrollPosition const): Deleted.
1911
1912 2019-02-27  Ulrich Pflueger  <up@nanocosmos.de>
1913
1914         [MSE] SourceBuffer sample time increment vs. last frame duration check is broken
1915         https://bugs.webkit.org/show_bug.cgi?id=194747
1916         <rdar://problem/48148469>
1917
1918         Reviewed by Jer Noble.
1919
1920         Prevent unintended frame drops by including last frame duration in discontinuity check. 
1921
1922         Test: media/media-source/media-source-append-variable-frame-lengths-with-matching-durations.html
1923
1924         * Modules/mediasource/SourceBuffer.cpp:
1925         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1926
1927 2019-02-27  Timothy Hatcher  <timothy@apple.com>
1928
1929         REGRESSION: WebKit content crash in Base System (because NSAppearance is NULL).
1930         https://bugs.webkit.org/show_bug.cgi?id=195086
1931         rdar://problem/48419124
1932
1933         Reviewed by Tim Horton.
1934
1935         * platform/mac/ScrollAnimatorMac.mm:
1936         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]): Always return a valid NSAppearance.
1937
1938 2019-02-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1939
1940         Remove conditional compile guard for InsertIntoTextNodeCommand::doReapply
1941         https://bugs.webkit.org/show_bug.cgi?id=195067
1942         <rdar://problem/44812080>
1943
1944         Reviewed by Tim Horton.
1945
1946         This iOS-specific override was introduced to fix <rdar://problem/7114425>, in which the last typed character
1947         would be revealed when redoing text input on iOS inside a password field. The associated change fixed this bug
1948         by overriding doReapply on iOS to only insert text (instead of additionally handling password echo); however, it
1949         really makes sense to skip password echo when redoing on all platforms, so we can just remove the platform-
1950         specific guards around this logic.
1951
1952         Doing this allows us to add the `hasEditableStyle()` check on iOS when redoing text insertion, which results in
1953         a very subtle behavior change covered by the new layout test below.
1954
1955         Test: editing/undo/redo-text-insertion-in-non-editable-node.html
1956
1957         * editing/InsertIntoTextNodeCommand.cpp:
1958         (WebCore::InsertIntoTextNodeCommand::doReapply):
1959         * editing/InsertIntoTextNodeCommand.h:
1960
1961 2019-02-26  Keith Miller  <keith_miller@apple.com>
1962
1963         Code quality cleanup in NeverDestroyed
1964         https://bugs.webkit.org/show_bug.cgi?id=194824
1965
1966         Reviewed by Mark Lam.
1967
1968         name_names.pl should not just assume the layout of LazyNeverDestroyed.
1969
1970         * dom/make_names.pl:
1971         (printNamesCppFile):
1972
1973 2019-02-26  Zalan Bujtas  <zalan@apple.com>
1974
1975         Do not try to observe the timer when Page is nullptr
1976         https://bugs.webkit.org/show_bug.cgi?id=195076
1977
1978         Reviewed by Tim Horton.
1979
1980         Covered by fast/dom/Window/timer-null-script-execution-context.html.
1981
1982         * page/DOMTimer.cpp:
1983         (WebCore::DOMTimer::install):
1984
1985 2019-02-20  Jer Noble  <jer.noble@apple.com>
1986
1987         [Cocoa] Media elements will restart network buffering just before suspending
1988         https://bugs.webkit.org/show_bug.cgi?id=193691
1989
1990         Reviewed by Eric Carlson.
1991
1992         API Test: WebKit.ProcessSuspendMediaBuffering
1993
1994         Allow the Page to suspend all media buffering in its child Documents.
1995
1996         * dom/Document.cpp:
1997         (WebCore::Document::suspendAllMediaBuffering):
1998         (WebCore::Document::resumeAllMediaBuffering):
1999         * dom/Document.h:
2000         * html/MediaElementSession.cpp:
2001         (WebCore::MediaElementSession::dataBufferingPermitted const):
2002         (WebCore::MediaElementSession::suspendBuffering):
2003         (WebCore::MediaElementSession::resumeBuffering):
2004         (WebCore::MediaElementSession::bufferingSuspended const):
2005         * html/MediaElementSession.h:
2006         * page/Page.cpp:
2007         (WebCore::Page::suspendAllMediaBuffering):
2008         (WebCore::Page::resumeAllMediaBuffering):
2009         * page/Page.h:
2010         (WebCore::Page::mediaPlaybackIsSuspended const):
2011         (WebCore::Page::mediaBufferingIsSuspended const):
2012         (WebCore::Page::mediaPlaybackIsSuspended): Deleted.
2013         * platform/audio/PlatformMediaSession.h:
2014         (WebCore::PlatformMediaSession::suspendBuffering):
2015         (WebCore::PlatformMediaSession::resumeBuffering):
2016         * platform/audio/PlatformMediaSessionManager.cpp:
2017         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
2018         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
2019         * platform/audio/PlatformMediaSessionManager.h:
2020
2021 2019-02-26  Youenn Fablet  <youenn@apple.com>
2022
2023         Move service worker response validation from the service worker client to the service worker itself
2024         https://bugs.webkit.org/show_bug.cgi?id=194716
2025
2026         Reviewed by Geoffrey Garen.
2027
2028         Added response validation at service worker side.
2029
2030         No change of behavior except for now logging validation error messages in the console.
2031         Covered by rebased tests.
2032
2033         * workers/service/context/ServiceWorkerFetch.cpp:
2034         (WebCore::ServiceWorkerFetch::validateResponse):
2035         (WebCore::ServiceWorkerFetch::processResponse):
2036         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2037
2038 2019-02-26  Sihui Liu  <sihui_liu@apple.com>
2039
2040         [Mac WK2] storage/indexeddb/IDBObject-leak.html is flaky
2041         https://bugs.webkit.org/show_bug.cgi?id=195036
2042
2043         Reviewed by Geoffrey Garen.
2044
2045         When connection to IDBServer is lost, IDBDatabase in web process should not only stop active transactions, but 
2046         also transactions in committing process.
2047
2048         Also, TransactionOpration should clear its perform function when the operation is being completed, otherwise 
2049         there is a reference cycle of TransactionOpration.
2050
2051         Covered by existing tests storage/indexeddb/IDBObject-leak.html.
2052
2053         * Modules/indexeddb/IDBDatabase.cpp:
2054         (WebCore::IDBDatabase::connectionToServerLost): notify committing transasctions that connection is lost.
2055         * Modules/indexeddb/IDBTransaction.cpp:
2056         (WebCore::IDBTransaction::connectionClosedFromServer): notify IDBConnectionProxy that transaction ends.
2057         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2058         (WebCore::IDBClient::IDBConnectionProxy::forgetTransaction): clear finished transactions.
2059         * Modules/indexeddb/client/IDBConnectionProxy.h:
2060         * Modules/indexeddb/client/TransactionOperation.h:
2061         (WebCore::IDBClient::TransactionOperation::doComplete): clear perform function unconditionally when the 
2062         operation is in completion process. 
2063
2064 2019-02-26  Zalan Bujtas  <zalan@apple.com>
2065
2066         [ContentChangeObserver] clearContentChangeObservers should be internal to ContentChangeObserver class
2067         https://bugs.webkit.org/show_bug.cgi?id=195066
2068         <rdar://problem/48411682>
2069
2070         Reviewed by Tim Horton.
2071
2072         Now all the empty clearContentChangeObservers() implementations can be removed.
2073
2074         * dom/Document.cpp:
2075         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
2076         * loader/EmptyClients.h:
2077         * page/ChromeClient.h:
2078         * page/Frame.cpp:
2079         (WebCore::Frame::willDetachPage):
2080         * page/ios/ContentChangeObserver.h:
2081         * page/ios/ContentChangeObserver.mm:
2082         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
2083         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects): Might need to merge them.
2084         (WebCore::ContentChangeObserver::willDetachPage):
2085
2086 2019-02-26  Zalan Bujtas  <zalan@apple.com>
2087
2088         [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
2089         https://bugs.webkit.org/show_bug.cgi?id=195062
2090         <rdar://problem/48409258>
2091
2092         Reviewed by Tim Horton.
2093
2094         Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
2095
2096         * dom/Document.cpp:
2097         (WebCore::Document::scheduleStyleRecalc):
2098         * page/DOMTimer.cpp:
2099         (WebCore::DOMTimer::install):
2100         * page/ios/ContentChangeObserver.h:
2101         * page/ios/ContentChangeObserver.mm:
2102         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2103         (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
2104         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
2105
2106 2019-02-26  Chris Dumez  <cdumez@apple.com>
2107
2108         [iOS] Regression(PSON) Scroll position is no longer restored when navigating back to reddit.com
2109         https://bugs.webkit.org/show_bug.cgi?id=195054
2110         <rdar://problem/48330549>
2111
2112         Reviewed by Geoff Garen.
2113
2114         Add MaintainMemoryCache flag to indicate that the memory cache should not get purged.
2115
2116         * page/MemoryRelease.cpp:
2117         (WebCore::releaseNoncriticalMemory):
2118         (WebCore::releaseCriticalMemory):
2119         (WebCore::releaseMemory):
2120         * page/MemoryRelease.h:
2121
2122 2019-02-26  Commit Queue  <commit-queue@webkit.org>
2123
2124         Unreviewed, rolling out r241970.
2125         https://bugs.webkit.org/show_bug.cgi?id=195057
2126
2127         made the QuickLook.LegacyQuickLookContent API test flakey
2128         (Requested by estes on #webkit).
2129
2130         Reverted changeset:
2131
2132         "[iOS] Break a reference cycle between PreviewLoader and
2133         ResourceLoader"
2134         https://bugs.webkit.org/show_bug.cgi?id=194964
2135         https://trac.webkit.org/changeset/241970
2136
2137 2019-02-26  Zalan Bujtas  <zalan@apple.com>
2138
2139         [ContentChangeObserver] Simplify content observation API by removing explicit DOMTimer observation.
2140         https://bugs.webkit.org/show_bug.cgi?id=195023
2141         <rdar://problem/48381885>
2142
2143         Reviewed by Tim Horton.
2144
2145         In the future we might decide that certain activities don't require DOMTimer observation, but that should
2146         be internal to ContentChangeObserver.
2147
2148         * page/ios/ContentChangeObserver.h:
2149         * page/ios/ContentChangeObserver.mm:
2150         (WebCore::ContentChangeObserver::startObservingContentChanges):
2151         (WebCore::ContentChangeObserver::stopObservingContentChanges):
2152         * page/ios/EventHandlerIOS.mm:
2153         (WebCore::EventHandler::mouseMoved):
2154
2155 2019-02-26  Zalan Bujtas  <zalan@apple.com>
2156
2157         [ContentChangeObserver] Move observing logic from Document::updateStyleIfNeeded to ContentChangeObserver
2158         https://bugs.webkit.org/show_bug.cgi?id=195032
2159         <rdar://problem/48388063>
2160
2161         Reviewed by Tim Horton.
2162
2163         This might eventually turn into a regular start/stop content observing call.
2164
2165         * dom/Document.cpp:
2166         (WebCore::Document::updateStyleIfNeeded):
2167         * page/ios/ContentChangeObserver.h:
2168         * page/ios/ContentChangeObserver.mm:
2169         (WebCore::ContentChangeObserver::startObservingStyleResolve):
2170         (WebCore::ContentChangeObserver::stopObservingStyleResolve):
2171
2172 2019-02-26  Zalan Bujtas  <zalan@apple.com>
2173
2174         [ContentChangeObserver] Move CheckForVisibilityChange to ContentChangeObserver class
2175         https://bugs.webkit.org/show_bug.cgi?id=195035
2176         <rdar://problem/48389123>
2177
2178         Reviewed by Tim Horton.
2179
2180         Visibility checking logic belongs to ContentChangeObserver.
2181
2182         * page/ios/ContentChangeObserver.h:
2183         * page/ios/ContentChangeObserver.mm:
2184         (WebCore::elementImplicitVisibility):
2185         (WebCore::ContentChangeObserver::StyleChange::StyleChange):
2186         (WebCore::ContentChangeObserver::StyleChange::~StyleChange):
2187         * rendering/updating/RenderTreeUpdater.cpp:
2188         (WebCore::RenderTreeUpdater::updateElementRenderer):
2189         (WebCore::elementImplicitVisibility): Deleted.
2190         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange): Deleted.
2191         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange): Deleted.
2192
2193 2019-02-26  Philippe Normand  <pnormand@igalia.com>
2194
2195         [EGL] Runtime support for RGB565 pixel layout
2196         https://bugs.webkit.org/show_bug.cgi?id=194817
2197
2198         Reviewed by Carlos Garcia Campos.
2199
2200         Currently our graphics pipeline always relies on a ARGB8888 (32
2201         bpp) pixel configuration. On some low-end (old) embedded platforms
2202         the graphics driver is sometimes optimized for 16 bpp
2203         configurations, such as RGB565. On those platforms the application
2204         can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to
2205         "RGB565" to adjust to the best pixel configuration supported by
2206         the screen and graphics driver.
2207
2208         * platform/graphics/egl/GLContextEGL.cpp:
2209         (WebCore::GLContextEGL::getEGLConfig):
2210
2211 2019-02-26  Philippe Normand  <pnormand@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
2212
2213         [WPE] Add API for webview background color configuration
2214         https://bugs.webkit.org/show_bug.cgi?id=192305
2215
2216         Reviewed by Michael Catanzaro.
2217
2218         Adapt the FrameView API to allow a default non-white background color.
2219
2220         * page/Frame.cpp:
2221         (WebCore::Frame::createView): Replace isTransparent argument with a background color one.
2222         * page/Frame.h:
2223         * page/FrameView.cpp:
2224         (WebCore::FrameView::recalculateBaseBackgroundColor): Use Color::transparent if m_isTransparent is true.
2225         (WebCore::FrameView::updateBackgroundRecursively): Allow the fallback background color to be non-white, this is
2226         used only in non-dark-mode-css build configurations.
2227         * page/FrameView.h:
2228         * testing/Internals.cpp:
2229         (WebCore::Internals::setViewIsTransparent): Use Color::transparent if transparent is true.
2230
2231 2019-02-25  Yongjun Zhang  <yongjun_zhang@apple.com>
2232
2233         scalableNativeWebpageParameters() is not preserved on new page navigation.
2234         https://bugs.webkit.org/show_bug.cgi?id=194892
2235         <rdar://problem/47538280>
2236
2237         If a page's current default viewport configuration is scalableNativeWebpageParameters due to
2238         the fact that m_canIgnoreScalingConstraints is true, loading a new page should preserve this
2239         configuration until we derive the right values from viewport meta-tag.
2240
2241         Reviewed by Wenson Hsieh.
2242
2243         Test: fast/viewport/ios/viewport-shrink-to-fit-on-new-navigation.html
2244
2245         * page/ViewportConfiguration.cpp:
2246         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): Use fixedNativeWebpageParameters().
2247         (WebCore::ViewportConfiguration::updateDefaultConfiguration): Use nativeWebpageParameters.
2248         (WebCore::ViewportConfiguration::nativeWebpageParameters): Return the appropriate default configuration
2249             based on m_canIgnoreScalingConstraints and shouldIgnoreMinimumEffectiveDeviceWidth().
2250         (WebCore::ViewportConfiguration::fixedNativeWebpageParameters): Renamed from nativeWebpageParameters()
2251         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Use fixedNativeWebpageParameters.
2252         * page/ViewportConfiguration.h: Make nativeWebpageParameters() an instance method and change the old
2253             static method to fixedNativeWebpageParameters which better reflects the actual behavior.
2254
2255 2019-02-25  Zalan Bujtas  <zalan@apple.com>
2256
2257         [ContentChangeObserver] Move observing logic from DOMWindow::clearTimeout to ContentChangeObserver
2258         https://bugs.webkit.org/show_bug.cgi?id=194988
2259         <rdar://problem/48343040>
2260
2261         Reviewed by Tim Horton.
2262
2263         ContentChangeObserver::removeDOMTimer takes care of the canceled timer removal.
2264
2265         * page/DOMWindow.cpp:
2266         (WebCore::DOMWindow::clearTimeout):
2267         * page/ios/ContentChangeObserver.h:
2268         * page/ios/ContentChangeObserver.mm:
2269         (WebCore::ContentChangeObserver::startObservingDOMTimer):
2270         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
2271         (WebCore::ContentChangeObserver::removeDOMTimer):
2272
2273 2019-02-25  Zalan Bujtas  <zalan@apple.com>
2274
2275         [ContentChangeObserver] Move observing logic from DOMTimer to ContentChangeObserver
2276         https://bugs.webkit.org/show_bug.cgi?id=194987
2277         <rdar://problem/48342910>
2278
2279         Reviewed by Tim Horton.
2280
2281         Content obvservation logic should all move to the ContentChangeObserver class.
2282
2283         * page/DOMTimer.cpp:
2284         (WebCore::DOMTimer::install):
2285         (WebCore::DOMTimer::fired):
2286         * page/Page.cpp:
2287         (WebCore::Page::Page):
2288         * page/Page.h:
2289         (WebCore::Page::contentChangeObserver):
2290         * page/ios/ContentChangeObserver.h:
2291         * page/ios/ContentChangeObserver.mm:
2292         (WebCore::ContentChangeObserver::ContentChangeObserver):
2293         (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded):
2294         (WebCore::ContentChangeObserver::startObservingDOMTimer):
2295         (WebCore::ContentChangeObserver::stopObservingDOMTimer):
2296         (WebCore::ContentChangeObserver::containsObservedDOMTimer):
2297         (WebCore::ContentChangeObserver::addObservedDOMTimer):
2298         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
2299
2300 2019-02-25  John Wilander  <wilander@apple.com>
2301
2302         Introduce and adopt new class RegistrableDomain for eTLD+1
2303         https://bugs.webkit.org/show_bug.cgi?id=194791
2304         <rdar://problem/48179240>
2305
2306         Reviewed by Alex Christensen, Fujii Hironori, and Brent Fulgham.
2307
2308         A new API test was added. Plenty of existing layout tests under
2309         http/tests/resourceLoadStatistics/ and http/tests/storageAccess/ test the code.
2310
2311         This patch introduces and adopts a new class called WebCore::RegistrableDomain
2312         which represents a domain's eTLD+1 (effective top level domain plus one) and is
2313         the basis for the term "site," as in same-site. Other popular names include
2314         high-level domain, primary domain, and top privately controlled/owned domain.
2315         Effective top level domains are enumerated on the Public Suffix List
2316         (https://publicsuffix.org).
2317
2318         This class just uses the full domain for when the Public Suffix List cannot help
2319         finding the registrable domain and for WebKit ports that haven't enabled
2320         PUBLIC_SUFFIX_LIST. It also uses the string "nullOrigin" as a representation
2321         for the null or unique origin (this matches how these origins were handled
2322         before).
2323
2324         The implementation is a wrapper around a String and the functions and class
2325         members that now make use of this new class used to handle regular String
2326         objects which didn't help much in terms of type safety or guarantees that the
2327         string had already been converted to an eTLD+1.
2328
2329         We've at least two bad bugs in the Storage Access API because of confusion
2330         between a URL's eTLD+1 and its host. The usage of WebCore::RegistrableDomain
2331         will prohibit such bugs in the future.
2332
2333         Partitioning in WebKit also uses eTLD+1 to a large extent. I plan to adopt
2334         WebCore::RegistrableDomain for partitioning in a later patch.
2335
2336         This patch also enhances parameter naming by:
2337         - Removing parts that refer to "primary" as in primaryDomain.
2338         - Replacing references to "TopPrivatelyControlledDomain" with "RegistrableDomain."
2339         - Replacing references to "TopPrivatelyOwnedDomain" with "RegistrableDomain."
2340         - Using the term "domain" consistently instead of e.g. "host."
2341
2342         * WebCore.xcodeproj/project.pbxproj:
2343         * dom/Document.cpp:
2344         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
2345         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
2346         * dom/Document.h:
2347         * html/HTMLAnchorElement.cpp:
2348         (WebCore::HTMLAnchorElement::parseAdClickAttribution const):
2349         * html/HTMLMediaElement.cpp:
2350         (WebCore::HTMLMediaElement::mediaSessionTitle const):
2351         * loader/AdClickAttribution.cpp:
2352         (WebCore::AdClickAttribution::url const):
2353         (WebCore::AdClickAttribution::referrer const):
2354         (WebCore::AdClickAttribution::toString const):
2355         * loader/AdClickAttribution.h:
2356         (WebCore::AdClickAttribution::Source::Source):
2357         (WebCore::AdClickAttribution::Source::matches const):
2358         (WebCore::AdClickAttribution::Source::deleteValue):
2359         (WebCore::AdClickAttribution::Destination::Destination):
2360         (WebCore::AdClickAttribution::Destination::matches const):
2361         (WebCore::AdClickAttribution::Destination::deleteValue):
2362         * loader/ResourceLoadObserver.cpp:
2363         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
2364         (WebCore::ResourceLoadObserver::setLogUserInteractionNotificationCallback):
2365         (WebCore::ResourceLoadObserver::setLogWebSocketLoadingNotificationCallback):
2366         (WebCore::ResourceLoadObserver::setLogSubresourceLoadingNotificationCallback):
2367         (WebCore::ResourceLoadObserver::setLogSubresourceRedirectNotificationCallback):
2368         (WebCore::ResourceLoadObserver::logSubresourceLoading):
2369         (WebCore::ResourceLoadObserver::logWebSocketLoading):
2370         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2371         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
2372         (WebCore::ResourceLoadObserver::logFontLoad):
2373         (WebCore::ResourceLoadObserver::logCanvasRead):
2374         (WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
2375         (WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
2376         (WebCore::ResourceLoadObserver::logScreenAPIAccessed):
2377         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
2378         (WebCore::ResourceLoadObserver::statisticsForOrigin):
2379         (WebCore::primaryDomain): Deleted.
2380         (WebCore::ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain): Deleted.
2381         * loader/ResourceLoadObserver.h:
2382         * loader/ResourceLoadStatistics.cpp:
2383         (WebCore::ResourceLoadStatistics::encode const):
2384         (WebCore::ResourceLoadStatistics::decode):
2385         (WebCore::ResourceLoadStatistics::toString const):
2386         (WebCore::ResourceLoadStatistics::merge):
2387         (WebCore::ResourceLoadStatistics::primaryDomain): Deleted.
2388         * loader/ResourceLoadStatistics.h:
2389         (WebCore::ResourceLoadStatistics::ResourceLoadStatistics):
2390         * page/Page.cpp:
2391         (WebCore::Page::logNavigation):
2392         (WebCore::Page::mainFrameLoadStarted):
2393         * page/Page.h:
2394         * page/PerformanceMonitor.cpp:
2395         (WebCore::reportPageOverPostLoadResourceThreshold):
2396         * platform/RegistrableDomain.h: Added.
2397         (WebCore::RegistrableDomain::RegistrableDomain):
2398         (WebCore::RegistrableDomain::isEmpty const):
2399         (WebCore::RegistrableDomain::string const):
2400         (WebCore::RegistrableDomain::operator!= const):
2401         (WebCore::RegistrableDomain::operator== const):
2402         (WebCore::RegistrableDomain::matches const):
2403         (WebCore::RegistrableDomain::isolatedCopy const):
2404         (WebCore::RegistrableDomain::isHashTableDeletedValue const):
2405         (WebCore::RegistrableDomain::hash const):
2406         (WebCore::RegistrableDomain::RegistrableDomainHash::hash):
2407         (WebCore::RegistrableDomain::RegistrableDomainHash::equal):
2408         (WebCore::RegistrableDomain::encode const):
2409         (WebCore::RegistrableDomain::decode):
2410         * platform/network/NetworkStorageSession.cpp:
2411         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
2412         (WebCore::NetworkStorageSession::shouldBlockCookies const):
2413         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
2414         (WebCore::NetworkStorageSession::removePrevalentDomains):
2415         (WebCore::NetworkStorageSession::hasStorageAccess const):
2416         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
2417         (WebCore::NetworkStorageSession::grantStorageAccess):
2418         (WebCore::getPartitioningDomain): Deleted.
2419         * platform/network/NetworkStorageSession.h:
2420
2421 2019-02-25  Chris Fleizach  <cfleizach@apple.com>
2422
2423         AX: <footer> HTML5 tag not reading as ARIA Landmark to VoiceOver
2424         https://bugs.webkit.org/show_bug.cgi?id=190138
2425         <rdar://problem/44907695>
2426
2427         Reviewed by Joanmarie Diggs.
2428
2429         Make sure that footer elements use the right role depending on their context.
2430         If scoped to body, they become contentinfo. Otherwise they are just delineated by
2431         a footer subrole.
2432
2433         * accessibility/AccessibilityObject.cpp:
2434         (WebCore::AccessibilityObject::isLandmark const):
2435         * accessibility/AccessibilityRenderObject.cpp:
2436         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
2437         (WebCore::AccessibilityRenderObject::isDescendantOfElementType const):
2438         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
2439         * accessibility/AccessibilityRenderObject.h:
2440         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2441         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
2442         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2443         (-[WebAccessibilityObjectWrapper subrole]):
2444
2445 2019-02-25  Sihui Liu  <sihui_liu@apple.com>
2446
2447         IndexedDB: IDBDatabase and IDBTransaction are leaked in layout tests
2448         https://bugs.webkit.org/show_bug.cgi?id=194709
2449
2450         Reviewed by Geoffrey Garen.
2451
2452         When connection to IDB server is closed, IDBTransaction would abort without notifying IDBDatabase, so 
2453         IDBDatabase didn't clear its reference to IDBTransaction which created a reference cycle. 
2454  
2455         Also IDBTransaction didn't clear its reference to IDBRequest in this case and it led to another reference cycle
2456         between IDBOpenDBRequest and IDBTransaction.
2457
2458         Test: storage/indexeddb/IDBObject-leak.html
2459
2460         * Modules/indexeddb/IDBDatabase.cpp:
2461         (WebCore::IDBDatabase::connectionToServerLost):
2462         * Modules/indexeddb/IDBTransaction.cpp:
2463         (WebCore::IDBTransaction::IDBTransaction):
2464         (WebCore::IDBTransaction::~IDBTransaction):
2465         (WebCore::IDBTransaction::connectionClosedFromServer):
2466         * Modules/indexeddb/IDBTransaction.h:
2467         * testing/Internals.cpp:
2468         (WebCore::Internals::numberOfIDBTransactions const):
2469         * testing/Internals.h:
2470         * testing/Internals.idl:
2471
2472 2019-02-25  Zalan Bujtas  <zalan@apple.com>
2473
2474         Add missing stream parameter. Unreviewed.
2475
2476         * page/DOMTimer.cpp:
2477         (WebCore::DOMTimer::fired):
2478
2479 2019-02-25  Zalan Bujtas  <zalan@apple.com>
2480
2481         Unreviewed build fix after r242032.
2482
2483         * page/DOMTimer.cpp:
2484         (WebCore::DOMTimer::install):
2485
2486 2019-02-20  Darin Adler  <darin@apple.com>
2487
2488         Incorrect use of String::foldCase for font family names
2489         https://bugs.webkit.org/show_bug.cgi?id=194895
2490
2491         Reviewed by Myles C. Maxfield.
2492
2493         * platform/graphics/FontCascadeDescription.cpp:
2494         (WebCore::FontCascadeDescription::familiesEqualForTextAutoSizing): Use
2495         familyNamesAreEqual instead of calling convertToASCIILowercase directly.
2496         (WebCore::FontCascadeDescription::familyNamesAreEqual): Use AtomicString's
2497         operator== when we want case sensitive family name comparisons. This is a special
2498         case to accomodate CoreText, which uses "."-prefix names for internal fonts that
2499         are treated case sensitively. (Ideally webpages would not use these fonts at all.)
2500         (WebCore::FontCascadeDescription::familyNameHash): Use AtomicString's existingHash
2501         when we want case sensitive family name hashing.
2502         (WebCore::FontCascadeDescription::foldedFamilyName): Take a String instead of an
2503         AtomicString so we can use this at an additional call site. Converting from an
2504         AtomicString to a String if free and automatic at the existing call sites. Use
2505         convertToASCIILowercase instead of foldCase for three reasons: 1) Other functions
2506         here are folding only ASCII case by using ASCIICaseInsensitiveHash, and this one
2507         must be consistent. 2) this is considerably faster, and 3) font family names don't
2508         need arbitrary Unicode case folding, it's only A-Z that should be folded.
2509         * platform/graphics/FontCascadeDescription.h: Take a String instead of AtomicString
2510         in the foldedFamilyName function.
2511
2512         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2513         (WebCore::FontDatabase::collectionForFamily): Instead of calling foldCase, use
2514         FontCascadeDescription::foldedFamilyName to correctly fold font family names.
2515
2516 2019-02-25  Charlie Turner  <cturner@igalia.com>
2517
2518         [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
2519         https://bugs.webkit.org/show_bug.cgi?id=194992
2520
2521         Reviewed by Xabier Rodriguez-Calvar.
2522
2523         Refactoring, no new tests.
2524
2525         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2526         (transformCaps): Simplify the code a little. The idea to use this
2527         utility function came from a review upstream here:
2528         https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
2529
2530 2019-02-25  Alicia Boya García  <aboya@igalia.com>
2531
2532         [MSE][GStreamer] Batch player duration updates
2533         https://bugs.webkit.org/show_bug.cgi?id=194220
2534
2535         Reviewed by Xabier Rodriguez-Calvar.
2536
2537         This saves up a ton of CPU cycles doing layout unnecessarily when all
2538         the appended frames extend the duration of the movie, like in
2539         YTTV 2018 59.DASHLatencyVP9.
2540
2541         This patch is an optimization that introduces no new behavior.
2542
2543         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2544         (WebCore::AppendPipeline::consumeAppsinkAvailableSamples):
2545         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2546         (WebCore::MediaPlayerPrivateGStreamerMSE::blockDurationChanges):
2547         (WebCore::MediaPlayerPrivateGStreamerMSE::unblockDurationChanges):
2548         (WebCore::MediaPlayerPrivateGStreamerMSE::durationChanged):
2549         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2550
2551 2019-02-25  Miguel Gomez  <magomez@igalia.com>
2552
2553         [WPE] Add support for holepunch using an external video player
2554         https://bugs.webkit.org/show_bug.cgi?id=194899
2555
2556         Reviewed by Xabier Rodriguez-Calvar.
2557
2558         Implement the holepunch feature to allow playback using an external player. This creates
2559         a new dummy MediaPlayerPrivateHolePunch that accepts only the type "video/holepunch", and
2560         whose goal is to just draw a transparent rectangle in the position where the video should be.
2561         This can be used to allow a player placed on a lower plane than the browser to become visible.
2562
2563         Added ManualTest wpe/video-player-holepunch-external.html to test the feature.
2564
2565         * PlatformWPE.cmake:
2566         * platform/HolePunch.cmake: Added.
2567         * platform/graphics/MediaPlayer.cpp:
2568         (WebCore::buildMediaEnginesVector):
2569         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Added.
2570         (WebCore::MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch):
2571         (WebCore::MediaPlayerPrivateHolePunch::~MediaPlayerPrivateHolePunch):
2572         (WebCore::MediaPlayerPrivateHolePunch::platformLayer const):
2573         (WebCore::MediaPlayerPrivateHolePunch::naturalSize const):
2574         (WebCore::MediaPlayerPrivateHolePunch::pushNextHolePunchBuffer):
2575         (WebCore::MediaPlayerPrivateHolePunch::swapBuffersIfNeeded):
2576         (WebCore::MediaPlayerPrivateHolePunch::proxy const):
2577         (WebCore::mimeTypeCache):
2578         (WebCore::MediaPlayerPrivateHolePunch::getSupportedTypes):
2579         (WebCore::MediaPlayerPrivateHolePunch::supportsType):
2580         (WebCore::MediaPlayerPrivateHolePunch::registerMediaEngine):
2581         (WebCore::MediaPlayerPrivateHolePunch::notifyReadyState):
2582         * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Added.
2583         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2584         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
2585
2586 2019-02-24  Zalan Bujtas  <zalan@apple.com>
2587
2588         Introduce ContentChangeObserver class
2589         https://bugs.webkit.org/show_bug.cgi?id=194977
2590         <rdar://problem/48338115>
2591
2592         Reviewed by Simon Fraser.
2593
2594         This patch is about piping through all the related WK* calls. 
2595
2596         * SourcesCocoa.txt:
2597         * WebCore.xcodeproj/project.pbxproj:
2598         * dom/Document.cpp:
2599         (WebCore::Document::scheduleStyleRecalc):
2600         (WebCore::Document::updateStyleIfNeeded):
2601         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
2602         * loader/FrameLoader.cpp:
2603         * page/DOMTimer.cpp:
2604         (WebCore::DOMTimer::install):
2605         (WebCore::DOMTimer::fired):
2606         * page/DOMWindow.cpp:
2607         (WebCore::DOMWindow::clearTimeout):
2608         * page/Frame.cpp:
2609         (WebCore::Frame::willDetachPage):
2610         * page/Page.h:
2611         (WebCore::Page::contentChangeObserver):
2612         * page/ios/EventHandlerIOS.mm:
2613         (WebCore::EventHandler::mouseMoved):
2614         * rendering/updating/RenderTreeUpdater.cpp:
2615         (WebCore::RenderTreeUpdater::updateElementRenderer):
2616         (WebCore::CheckForVisibilityChange::CheckForVisibilityChange):
2617         (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
2618
2619 2019-02-24  Simon Fraser  <simon.fraser@apple.com>
2620
2621         Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
2622         https://bugs.webkit.org/show_bug.cgi?id=194984
2623
2624         Reviewed by Sam Weinig.
2625
2626         Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
2627
2628         Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
2629         current layout viewport rect. Instead, set the layout viewport on the root
2630         node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
2631
2632         * page/scrolling/ScrollingTree.cpp:
2633         (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
2634         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
2635         * page/scrolling/ScrollingTree.h:
2636         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
2637         (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
2638         * page/scrolling/ScrollingTreeFrameHostingNode.h:
2639         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2640         * page/scrolling/ScrollingTreeNode.h:
2641         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2642         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
2643         * page/scrolling/ScrollingTreeScrollingNode.h:
2644         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
2645         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
2646         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
2647         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
2648         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
2649         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
2650         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2651         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2652         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2653         (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
2654         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
2655
2656 2019-02-24  Devin Rousso  <drousso@apple.com>
2657
2658         Web Inspector: Change the InspectorOverlay to use native rather than canvas
2659         https://bugs.webkit.org/show_bug.cgi?id=105023
2660         <rdar://problem/13443692>
2661
2662         Reviewed by Brian Burg.
2663
2664         Should be no change in observed functionality.
2665
2666         * inspector/InspectorOverlay.h:
2667         * inspector/InspectorOverlay.cpp:
2668         (WebCore::truncateWithEllipsis): Added.
2669         (WebCore::localPointToRootPoint): Added.
2670         (WebCore::contentsQuadToCoordinateSystem):
2671         (WebCore::effectiveElementForNode): Added.
2672         (WebCore::quadToPath): Added.
2673         (WebCore::drawOutlinedQuadWithClip): Added.
2674         (WebCore::drawOutlinedQuad): Added.
2675         (WebCore::drawFragmentHighlight): Added.
2676         (WebCore::drawShapeHighlight): Added.
2677         (WebCore::InspectorOverlay::paint):
2678         (WebCore::InspectorOverlay::setIndicating):
2679         (WebCore::InspectorOverlay::shouldShowOverlay const):
2680         (WebCore::InspectorOverlay::update):
2681         (WebCore::InspectorOverlay::setShowPaintRects): Added.
2682         (WebCore::InspectorOverlay::showPaintRect):
2683         (WebCore::InspectorOverlay::updatePaintRectsTimerFired):
2684         (WebCore::InspectorOverlay::drawNodeHighlight):
2685         (WebCore::InspectorOverlay::drawQuadHighlight):
2686         (WebCore::InspectorOverlay::drawPaintRects):
2687         (WebCore::InspectorOverlay::drawBounds): Added.
2688         (WebCore::InspectorOverlay::drawRulers):
2689         (WebCore::InspectorOverlay::drawElementTitle): Added.
2690         (WebCore::contentsQuadToPage): Deleted.
2691         (WebCore::InspectorOverlay::setPausedInDebuggerMessage): Deleted.
2692         (WebCore::buildObjectForPoint): Deleted.
2693         (WebCore::buildObjectForRect): Deleted.
2694         (WebCore::buildArrayForQuad): Deleted.
2695         (WebCore::buildObjectForHighlight): Deleted.
2696         (WebCore::buildObjectForSize): Deleted.
2697         (WebCore::InspectorOverlay::setShowingPaintRects): Deleted.
2698         (WebCore::buildArrayForRendererFragments): Deleted.
2699         (WebCore::localPointToRoot): Deleted.
2700         (WebCore::appendPathCommandAndPoints): Deleted.
2701         (WebCore::appendPathSegment): Deleted.
2702         (WebCore::buildObjectForShapeOutside): Deleted.
2703         (WebCore::buildObjectForElementData): Deleted.
2704         (WebCore::InspectorOverlay::buildHighlightObjectForNode const): Deleted.
2705         (WebCore::InspectorOverlay::buildObjectForHighlightedNodes const): Deleted.
2706         (WebCore::InspectorOverlay::drawPausedInDebuggerMessage): Deleted.
2707         (WebCore::InspectorOverlay::overlayPage): Deleted.
2708         (WebCore::InspectorOverlay::forcePaint): Deleted.
2709         (WebCore::InspectorOverlay::reset): Deleted.
2710         (WebCore::evaluateCommandInOverlay): Deleted.
2711         (WebCore::InspectorOverlay::evaluateInOverlay): Deleted.
2712         (WebCore::InspectorOverlay::freePage): Deleted.
2713
2714         * inspector/agents/InspectorPageAgent.cpp:
2715         (WebCore::InspectorPageAgent::disable):
2716         (WebCore::InspectorPageAgent::setShowPaintRects):
2717         Drive-by: rename `setShowingPaintRects` to better match the protocol.
2718
2719         * inspector/agents/page/PageDebuggerAgent.h:
2720         * inspector/agents/page/PageDebuggerAgent.cpp:
2721         (WebCore::PageDebuggerAgent::PageDebuggerAgent):
2722         (WebCore::PageDebuggerAgent::setOverlayMessage): Deleted.
2723         Remove `Debugger.setOverlayMessage` command as it hasn't been used and is no longer supported.
2724
2725         * inspector/InspectorController.h:
2726         * inspector/InspectorController.cpp:
2727         (WebCore::InspectorController::createLazyAgents):
2728         (WebCore::InspectorController::disconnectFrontend):
2729         (WebCore::InspectorController::disconnectAllFrontends):
2730         (WebCore::InspectorController::buildObjectForHighlightedNodes const): Deleted.
2731
2732         * testing/Internals.h:
2733         * testing/Internals.idl:
2734         * testing/Internals.cpp:
2735         (WebCore::Internals::inspectorHighlightObject): Deleted.
2736
2737         * inspector/InspectorOverlayPage.css: Removed.
2738         * inspector/InspectorOverlayPage.html: Removed.
2739         * inspector/InspectorOverlayPage.js: Removed.
2740
2741         * CMakeLists.txt:
2742         * DerivedSources-input.xcfilelist:
2743         * DerivedSources-output.xcfilelist:
2744         * DerivedSources.make:
2745         * WebCore.xcodeproj/project.pbxproj:
2746
2747 2019-02-20  Darin Adler  <darin@apple.com>
2748
2749         Finish removing String::format
2750         https://bugs.webkit.org/show_bug.cgi?id=194893
2751
2752         Reviewed by Daniel Bates.
2753
2754         * dom/Document.cpp:
2755         (WebCore::Document::lastModified const): Use makeString and pad.
2756         * html/FTPDirectoryDocument.cpp:
2757         (WebCore::processFileDateString): Ditto.
2758
2759         * mathml/MathMLElement.cpp:
2760         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
2761
2762         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2763         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
2764
2765         * page/linux/ResourceUsageOverlayLinux.cpp:
2766         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
2767         (WebCore::gcTimerString): Use String::number.
2768
2769         * platform/DateComponents.cpp:
2770         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
2771         (WebCore::DateComponents::toString const): Ditto.
2772
2773         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
2774         and that was also inaccurate.
2775
2776         * platform/audio/HRTFElevation.cpp:
2777         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2778         Use makeString and pad.
2779         * platform/mock/MockRealtimeVideoSource.cpp:
2780         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
2781         * rendering/RenderLayerCompositor.cpp:
2782         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
2783         * rendering/RenderTheme.cpp:
2784         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
2785
2786 2019-02-24  Michael Catanzaro  <mcatanzaro@igalia.com>
2787
2788         [WPE][GTK] Remove user agent quirk for washingtonpost.com
2789         https://bugs.webkit.org/show_bug.cgi?id=194981
2790
2791         Reviewed by Žan Doberšek.
2792
2793         Remove user agent quirk for washingtonpost.com because we support JPEG 2000 now.
2794
2795         * platform/UserAgentQuirks.cpp:
2796         (WebCore::urlRequiresChromeBrowser):
2797
2798 2019-02-23  Simon Fraser  <simon.fraser@apple.com>
2799
2800         Remove remnants of iOS WK1 scrolling tree code
2801         https://bugs.webkit.org/show_bug.cgi?id=194980
2802
2803         Reviewed by Sam Weinig.
2804
2805         Remove ScrollingTreeIOS and ScrollingCoordinatorIOS which were never instantiated,
2806         to reduce maintenance costs and simplify.
2807
2808         Merge ScrollingTreeFrameScrollingNodeIOS into ScrollingTreeFrameScrollingNodeRemoteIOS
2809         since that was the only concrete subclass, removing code which never applies to iOS WK2
2810         (e.g. the synchronous scrolling code path).
2811
2812         * SourcesCocoa.txt:
2813         * WebCore.xcodeproj/project.pbxproj:
2814         * page/FrameView.h:
2815         * page/scrolling/ScrollingCoordinator.cpp:
2816         * page/scrolling/ScrollingTree.h:
2817         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2818         * page/scrolling/ScrollingTreeNode.h:
2819         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2820         (WebCore::ScrollingTreeScrollingNode::handleWheelEvent):
2821         * page/scrolling/ScrollingTreeScrollingNode.h:
2822         (WebCore::ScrollingTreeScrollingNode::updateLayersAfterDelegatedScroll): Deleted.
2823         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const): Deleted.
2824         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const): Deleted.
2825         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets const): Deleted.
2826         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets const): Deleted.
2827         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges const): Deleted.
2828         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges const): Deleted.
2829         (WebCore::ScrollingTreeScrollingNode::currentHorizontalSnapPointIndex const): Deleted.
2830         (WebCore::ScrollingTreeScrollingNode::currentVerticalSnapPointIndex const): Deleted.
2831         (WebCore::ScrollingTreeScrollingNode::setCurrentHorizontalSnapPointIndex): Deleted.
2832         (WebCore::ScrollingTreeScrollingNode::setCurrentVerticalSnapPointIndex): Deleted.
2833         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const): Deleted.
2834         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const): Deleted.
2835         (WebCore::ScrollingTreeScrollingNode::reachableContentsSize const): Deleted.
2836         (WebCore::ScrollingTreeScrollingNode::parentRelativeScrollableRect const): Deleted.
2837         (WebCore::ScrollingTreeScrollingNode::scrollOrigin const): Deleted.
2838         (WebCore::ScrollingTreeScrollingNode::totalContentsSizeForRubberBand const): Deleted.
2839         (WebCore::ScrollingTreeScrollingNode::setTotalContentsSizeForRubberBand): Deleted.
2840         (WebCore::ScrollingTreeScrollingNode::horizontalScrollElasticity const): Deleted.
2841         (WebCore::ScrollingTreeScrollingNode::verticalScrollElasticity const): Deleted.
2842         (WebCore::ScrollingTreeScrollingNode::hasEnabledHorizontalScrollbar const): Deleted.
2843         (WebCore::ScrollingTreeScrollingNode::hasEnabledVerticalScrollbar const): Deleted.
2844         (WebCore::ScrollingTreeScrollingNode::canHaveScrollbars const): Deleted.
2845         (WebCore::ScrollingTreeScrollingNode::expectsWheelEventTestTrigger const): Deleted.
2846         (WebCore::ScrollingTreeScrollingNode::scrollContainerLayer const): Deleted.
2847         (WebCore::ScrollingTreeScrollingNode::scrolledContentsLayer const): Deleted.
2848         * page/scrolling/ios/ScrollingCoordinatorIOS.h: Removed.
2849         * page/scrolling/ios/ScrollingCoordinatorIOS.mm: Removed.
2850         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Removed.
2851         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Removed.
2852         * page/scrolling/ios/ScrollingTreeIOS.cpp: Removed.
2853         * page/scrolling/ios/ScrollingTreeIOS.h: Removed.
2854         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2855         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
2856
2857 2019-02-23  Justin Fan  <justin_fan@apple.com>
2858
2859         [WebGPU] Buffer updates part 1: async mapping functions, unmap, and destroy
2860         https://bugs.webkit.org/show_bug.cgi?id=194665
2861
2862         Reviewed by Dean Jackson.
2863
2864         Test: map-write-buffers.html. Other tests updated to match new API.
2865
2866         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp: Added.
2867         (WebCore::validateBufferBindingType): Ensure buffer binding usages match the binding type.
2868         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Logic moved out from WebGPUDevice.cpp.
2869         * Modules/webgpu/WebGPUBindGroupDescriptor.h:
2870         * Modules/webgpu/WebGPUBuffer.cpp: Added GPUBuffer functionality.
2871         (WebCore::WebGPUBuffer::create):
2872         (WebCore::WebGPUBuffer::WebGPUBuffer):
2873         (WebCore::WebGPUBuffer::mapReadAsync):
2874         (WebCore::WebGPUBuffer::mapWriteAsync):
2875         (WebCore::WebGPUBuffer::unmap):
2876         (WebCore::WebGPUBuffer::destroy):
2877         (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback): Register a mapping request on the GPUBuffer, if valid.
2878         * Modules/webgpu/WebGPUBuffer.h:
2879         (WebCore::WebGPUBuffer::buffer const):
2880         (WebCore::WebGPUBuffer::mapping const): Deleted.
2881         * Modules/webgpu/WebGPUBuffer.idl: Update to latest API and enable every function except setSubData.
2882         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2883         (WebCore::WebGPUCommandBuffer::beginRenderPass): Renamed descriptor conversion method.
2884         * Modules/webgpu/WebGPUDevice.cpp:
2885         (WebCore::WebGPUDevice::createBuffer const): Update to non-nullable return type.
2886         (WebCore::WebGPUDevice::createBindGroup const): Move descriptor validation logic to descriptor implementation.
2887         * Modules/webgpu/WebGPUDevice.h:
2888         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
2889         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const): Renamed from validateAndConvertToGPUVersion.
2890         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
2891         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Add validation for submitted buffers.
2892         * platform/graphics/gpu/GPUBuffer.cpp: Added.
2893         (WebCore::GPUBuffer::PendingMappingCallback::PendingMappingCallback): New struct for retaining a reference to mapping callbacks.
2894         * platform/graphics/gpu/GPUBuffer.h: Add functionality to retain callbacks and usage bits.
2895         (WebCore::GPUBuffer::isVertex const):
2896         (WebCore::GPUBuffer::isUniform const):
2897         (WebCore::GPUBuffer::isStorage const):
2898         (WebCore::GPUBuffer::isReadOnly const):
2899         (WebCore::GPUBuffer::PendingMapPromise::create):
2900         (WebCore::GPUBuffer::isMappable const):
2901         (WebCore::GPUBuffer::isMapWriteable const):
2902         (WebCore::GPUBuffer::isMapReadable const):
2903         (WebCore::GPUBuffer::mapping const): Deleted.
2904         * platform/graphics/gpu/GPUBufferUsage.h: enum class cannot be logical ORed together.
2905         * platform/graphics/gpu/GPUDevice.cpp:
2906         (WebCore::GPUDevice::tryCreateBuffer const): Renamed from createBuffer. 
2907         (WebCore::GPUDevice::createBuffer const): Deleted.
2908         * platform/graphics/gpu/GPUDevice.h:
2909         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2910         (WebCore::GPUBuffer::tryCreateSharedBuffer): Attempt to create a MTLBuffer with shared memory.
2911         (WebCore::GPUBuffer::tryCreate): No longer use Gigacage-allocated memory for MTLBuffer.
2912         (WebCore::GPUBuffer::GPUBuffer):
2913         (WebCore::GPUBuffer::~GPUBuffer):
2914         (WebCore::GPUBuffer::registerMappingCallback): Register the provided callback to be executed when the staging buffer can be safely exposed.
2915         (WebCore::GPUBuffer::stagingBufferForRead): Prepare the arrayBuffer for reading and run the mapping callback.
2916         (WebCore::GPUBuffer::stagingBufferForWrite): Ditto, but for writing.
2917         (WebCore::GPUBuffer::unmap): If needed, copy the staging ArrayBuffer to the MTLBuffer. Unregister any mapping callback.
2918         (WebCore::GPUBuffer::destroy): Stub implementation for now. Frees the MTLBuffer as soon as possible.
2919         (WebCore::GPUBuffer::create): Deleted.
2920         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
2921         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Ensure only read-only GPUBuffers are used as read-only on the GPU.
2922
2923         Add symbols for new files:
2924         * Sources.txt:
2925         * WebCore.xcodeproj/project.pbxproj:
2926
2927 2019-02-23  Keith Miller  <keith_miller@apple.com>
2928
2929         Add new mac target numbers
2930         https://bugs.webkit.org/show_bug.cgi?id=194955
2931
2932         Reviewed by Tim Horton.
2933
2934         * Configurations/Base.xcconfig:
2935         * Configurations/DebugRelease.xcconfig:
2936
2937 2019-02-23  chris fleizach  <cfleizach@apple.com>
2938
2939         AX: WebKit is incorrectly mapping the <meter> element to progressbar
2940         https://bugs.webkit.org/show_bug.cgi?id=164051
2941         <rdar://problem/29055615>
2942
2943         Reviewed by Joanmarie Diggs.
2944
2945         Add a specific role for meter and map that to the appropriate mac role. 
2946
2947         * accessibility/AccessibilityNodeObject.cpp:
2948         (WebCore::AccessibilityNodeObject::canHaveChildren const):
2949         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
2950         * accessibility/AccessibilityObject.cpp:
2951         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
2952         (WebCore::AccessibilityObject::isRangeControl const):
2953         (WebCore::AccessibilityObject::computedRoleString const):
2954         * accessibility/AccessibilityObjectInterface.h:
2955         * accessibility/AccessibilityProgressIndicator.cpp:
2956         (WebCore::AccessibilityProgressIndicator::roleValue const):
2957         * accessibility/AccessibilityProgressIndicator.h:
2958         * accessibility/AccessibilityRenderObject.cpp:
2959         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
2960         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2961         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
2962         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2963         (createAccessibilityRoleMap):
2964
2965 2019-02-22  Ryosuke Niwa  <rniwa@webkit.org>
2966
2967         Crash in SWServerJobQueue::runNextJobSynchronously
2968         https://bugs.webkit.org/show_bug.cgi?id=194974
2969
2970         Reviewed by Geoffrey Garen.
2971
2972         We suspect the crash is happening due to m_jobQueue being empty in runNextJobSynchronously
2973         or there is a timer heap corruption again :(
2974
2975         Exit early when m_jobQueue is empty. Also add a debug assert that this should never happen
2976         but convert an existing release assert to a debug assert since this appears to be hitting
2977         too frequently in wild.
2978
2979         * workers/service/server/SWServerJobQueue.cpp:
2980         (WebCore::SWServerJobQueue::runNextJobSynchronously):
2981
2982 2019-02-22  Simon Fraser  <simon.fraser@apple.com>
2983
2984         Clean up the setScrollPosition/setScrollPositionWithoutContentEdgeConstraints confusion in the scrolling tree nodes
2985         https://bugs.webkit.org/show_bug.cgi?id=194968
2986
2987         Reviewed by Antti Koivisto.
2988
2989         Having both setScrollPosition() and setScrollPositionWithoutContentEdgeConstraints() is confusing because
2990         you can't tell which is the bottleneck. So add a 'clamp' parameter to setScrollPosition() and merge them.
2991
2992         ScrollingTreeFrameScrollingNodeMac::setScrollPosition() replicates a bit of code but future cleanups will
2993         reduce that.
2994
2995         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2996         (WebCore::ScrollingTreeFrameScrollingNode::setScrollPosition): Deleted. This was the same as the base class method.
2997         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2998         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2999         (WebCore::ScrollingTreeScrollingNode::setScrollPosition):
3000         (WebCore::ScrollingTreeScrollingNode::clampScrollPosition const):
3001         (WebCore::ScrollingTreeScrollingNode::scrollBy):
3002         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints): Deleted.
3003         (WebCore::ScrollingTreeScrollingNode::scrollByWithoutContentEdgeConstraints): Deleted.
3004         * page/scrolling/ScrollingTreeScrollingNode.h:
3005         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
3006         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3007         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPosition):
3008         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints): Deleted. Did nothing.
3009         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3010         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3011         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3012         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
3013         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPosition):
3014         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
3015         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
3016         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3017         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPosition):
3018         (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints): Deleted.
3019         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
3020         (WebCore::ScrollingTreeScrollingNodeDelegateMac::immediateScrollByWithoutContentEdgeConstraints):
3021         * platform/PlatformWheelEvent.h:
3022         (WebCore::PlatformWheelEvent::delta const):
3023         * platform/ScrollTypes.h:
3024
3025 2019-02-22  Eric Liang  <ericliang@apple.com>
3026
3027         AX: Treat AXChildrenInNavigationOrder as AXChildren before adding support for aria-flowto
3028         https://bugs.webkit.org/show_bug.cgi?id=194923
3029
3030         Reviewed by Chris Fleizach.
3031
3032         Added AXChildrenInNavigationOrder attribute that returns the same array as from AXChildren. It prevents AppKit from reordering elements from the fallback AXChildren attribute.
3033
3034         Test: accessibility/mac/children-in-navigation-order-returns-children.html
3035
3036         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3037         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3038
3039 2019-02-22  Tim Horton  <timothy_horton@apple.com>
3040
3041         ProcessSwap.PageOverlayLayerPersistence fails on iOS and in debug builds
3042         https://bugs.webkit.org/show_bug.cgi?id=194963
3043
3044         Reviewed by Dean Jackson.
3045
3046         Tested by existing failing API test.
3047
3048         * page/Page.cpp:
3049         (WebCore::Page::installedPageOverlaysChanged): Deleted.
3050         * page/Page.h:
3051         (WebCore::Page::pageOverlayController):
3052         * page/PageOverlayController.cpp:
3053         (WebCore::PageOverlayController::installedPageOverlaysChanged):
3054         (WebCore::PageOverlayController::detachViewOverlayLayers):
3055         (WebCore::PageOverlayController::installPageOverlay):
3056         (WebCore::PageOverlayController::uninstallPageOverlay):
3057         (WebCore::PageOverlayController::willDetachRootLayer): Deleted.
3058         * page/PageOverlayController.h:
3059         As intended by r240940, move installedPageOverlaysChanged to PageOverlayController.
3060         Also, make it ignore isInWindow state; otherwise, if you install a overlay
3061         and then come into window, nothing installs the root layer. There is no
3062         need for this code to follow in-window state manually anymore since
3063         the DrawingArea and RenderLayerCompositor just hook the layers up when needed.
3064
3065         Make some methods private, and make detachViewOverlayLayers only touch
3066         *view* overlays, so that we don't detach the document-relative root
3067         layer when you drop to having no view overlays. This maintains
3068         existing behavior because nothing was calling PageOverlayController::detachViewOverlayLayers.
3069
3070         Now there are no callers of willDetachRootLayer, so remove it.
3071
3072 2019-02-22  Andy Estes  <aestes@apple.com>
3073
3074         [iOS] Break a reference cycle between PreviewLoader and ResourceLoader
3075         https://bugs.webkit.org/show_bug.cgi?id=194964
3076         <rdar://problem/48279441>
3077
3078         Reviewed by Alex Christensen.
3079
3080         When a document's QuickLook preview is loaded, a reference cycle is created between
3081         PreviewLoader and ResourceLoader. Break the cycle by clearing m_previewLoader in
3082         ResourceLoader::releaseResources().
3083
3084         Fixes leaks detected by `run-webkit-tests --leaks LayoutTests/quicklook`.
3085
3086         * loader/ResourceLoader.cpp:
3087         (WebCore::ResourceLoader::releaseResources):
3088
3089 2019-02-22  Sihui Liu  <sihui_liu@apple.com>
3090
3091         Crash under IDBServer::IDBConnectionToClient::identifier() const
3092         https://bugs.webkit.org/show_bug.cgi?id=194843
3093         <rdar://problem/48203102>
3094
3095         Reviewed by Geoffrey Garen.
3096
3097         UniqueIDBDatabase should ignore requests from connections that are already closed.
3098
3099         Tests are hard to create without some tricks on UniqueIDBDatabase so this fix is verified manually. 
3100         One test is created by adding delay to UniqueIDBDatabase::openBackingStore on the background thread to make sure
3101         disconnection of web process happens before UniqueIDBDatabase::didOpenBackingStore, because didOpenBackingStore
3102         may start a version change transaction and ask for identifier from the connection that is already gone.
3103
3104         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
3105         (WebCore::IDBServer::IDBConnectionToClient::connectionToClientClosed):
3106         * Modules/indexeddb/server/IDBConnectionToClient.h:
3107         (WebCore::IDBServer::IDBConnectionToClient::isClosed):
3108         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3109         (WebCore::IDBServer::UniqueIDBDatabase::clearStalePendingOpenDBRequests):
3110         (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
3111         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
3112         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3113
3114 2019-02-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3115
3116         Input type "formatSetInlineTextDirection" is dispatched when changing paragraph-level text direction
3117         https://bugs.webkit.org/show_bug.cgi?id=194703
3118         <rdar://problem/48111775>
3119
3120         Reviewed by Ryosuke Niwa.
3121
3122         Currently, when changing text direction, WebKit always sends input events of type formatSetInlineTextDirection,
3123         even when changing paragraph text direction. Instead, we should be emitting formatSetBlockTextDirection in this
3124         scenario. This is problematic when using the context menus on macOS to change writing direction, since changing
3125         "Selection Direction" is currently indistinguishable from changing "Paragraph Direction".
3126
3127         To fix this, we split EditAction::SetWritingDirection into EditAction::SetInlineWritingDirection and
3128         EditAction::SetBlockWritingDirection, which emit inline and block text direction input events, respectively.
3129
3130         Tests: fast/events/before-input-events-prevent-block-text-direction.html
3131                fast/events/before-input-events-prevent-inline-text-direction.html
3132
3133         * editing/CompositeEditCommand.cpp:
3134         (WebCore::CompositeEditCommand::apply):
3135         * editing/EditAction.cpp:
3136         (WebCore::undoRedoLabel):
3137         * editing/EditAction.h:
3138         * editing/EditCommand.cpp:
3139         (WebCore::inputTypeNameForEditingAction):
3140         * editing/Editor.cpp:
3141         (WebCore::inputEventDataForEditingStyleAndAction):
3142         (WebCore::Editor::setBaseWritingDirection):
3143         * editing/EditorCommand.cpp:
3144         (WebCore::executeMakeTextWritingDirectionLeftToRight):
3145         (WebCore::executeMakeTextWritingDirectionNatural):
3146         (WebCore::executeMakeTextWritingDirectionRightToLeft):
3147
3148 2019-02-22  Rob Buis  <rbuis@igalia.com>
3149
3150         Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
3151         https://bugs.webkit.org/show_bug.cgi?id=160172
3152
3153         Reviewed by Frédéric Wang.
3154
3155         Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
3156         from HTTPParsers instead.
3157
3158         No new tests, already covered by MathML tests.
3159
3160         * mathml/MathMLElement.cpp:
3161         (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
3162         * mathml/MathMLElement.h:
3163         * mathml/MathMLPresentationElement.cpp:
3164         (WebCore::MathMLPresentationElement::parseMathMLLength):
3165         * mathml/MathMLTokenElement.cpp:
3166         (WebCore::MathMLTokenElement::convertToSingleCodePoint):
3167
3168 2019-02-22  Eric Carlson  <eric.carlson@apple.com>
3169
3170         Update some media logging
3171         https://bugs.webkit.org/show_bug.cgi?id=194915
3172
3173         Reviewed by Jer Noble.
3174
3175         No new tests, no functional change.
3176
3177         * Modules/mediasource/SourceBuffer.cpp:
3178         (WebCore::SourceBuffer::evictCodedFrames):
3179         (WebCore::SourceBuffer::provideMediaData):
3180         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
3181
3182         * html/HTMLMediaElement.cpp:
3183         (WebCore::HTMLMediaElement::checkPlaybackTargetCompatablity):
3184         (WebCore::HTMLMediaElement::loadResource):
3185         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
3186         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
3187         (WebCore::HTMLMediaElement::seekTask):
3188         (WebCore::HTMLMediaElement::playInternal):
3189         (WebCore::HTMLMediaElement::pauseInternal):
3190         (WebCore::HTMLMediaElement::setLoop):
3191         (WebCore::HTMLMediaElement::setControls):
3192         (WebCore::HTMLMediaElement::sourceWasRemoved):
3193
3194         * html/MediaElementSession.cpp:
3195         (WebCore::convertEnumerationToString):
3196
3197         * html/MediaElementSession.h:
3198         (WTF::LogArgument<WebCore::MediaPlaybackDenialReason>::toString):
3199
3200         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3201         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
3202
3203 2019-02-22  Rob Buis  <rbuis@igalia.com>
3204
3205         Fix unitless usage of mathsize
3206         https://bugs.webkit.org/show_bug.cgi?id=194940
3207
3208         Reviewed by Frédéric Wang.
3209
3210         Convert unitless lengths to percentage values to correct the computed
3211         font size.
3212
3213         * mathml/MathMLElement.cpp:
3214         (WebCore::convertToPercentageIfNeeded):
3215         (WebCore::MathMLElement::collectStyleForPresentationAttribute):
3216
3217 2019-02-21  Simon Fraser  <simon.fraser@apple.com>
3218
3219         Hardcode Visual Viewports on everywhere except iOS WK1
3220         https://bugs.webkit.org/show_bug.cgi?id=194928
3221
3222         Reviewed by Zalan Bujtas.
3223
3224         Remove the WK1 and WK2 preferences and MiniBrowser menu item for "visual viewports",
3225         change the default value of the Setting to 'true', and hardcode WebView on iOS to
3226         set it to false. The setting has shipped for several years and there's no need to turn
3227         it off now.
3228
3229         Similarly, disable the "Visual Viewport API" on iOS WK1, since it makes no sense if
3230         Visual Viewports are not enabled.
3231         
3232         Remove the "visualViewportEnabled" flag and unused code paths from scrolling tree code
3233         that only runs in WK2
3234
3235         * page/Settings.yaml:
3236         * page/scrolling/AsyncScrollingCoordinator.cpp:
3237         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3238         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3239         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled const): Deleted.
3240         * page/scrolling/AsyncScrollingCoordinator.h:
3241         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
3242         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
3243         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
3244         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties const):
3245         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled): Deleted.
3246         * page/scrolling/ScrollingStateFrameScrollingNode.h:
3247         * page/scrolling/ScrollingTree.cpp:
3248         (WebCore::ScrollingTree::commitTreeState):
3249         * page/scrolling/ScrollingTree.h:
3250         (WebCore::ScrollingTree::visualViewportEnabled const): Deleted.
3251         (WebCore::ScrollingTree::setVisualViewportEnabled): Deleted.
3252         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3253         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition const):
3254         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3255         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
3256         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
3257
3258 2019-02-21  Darin Adler  <darin@apple.com>
3259
3260         Some refinements for Node and Document
3261         https://bugs.webkit.org/show_bug.cgi?id=194764
3262
3263         Reviewed by Ryosuke Niwa.
3264
3265         * accessibility/AccessibilityObject.cpp:
3266         (WebCore::AccessibilityObject::press): Use shadowHost instead of
3267         deprecatedShadowAncestorNode.
3268         (WebCore::AccessibilityObject::axObjectCache const): Tweak coding style.
3269         (WebCore::AccessibilityObject::focusedUIElement const): Use existing page
3270         function to streamline.
3271
3272         * accessibility/AccessibilityRenderObject.cpp:
3273         (WebCore::AccessibilityRenderObject::accessKey const): Use
3274         attributeWithoutSynchronization for efficiency and consistency with other
3275         code working with the accesskey attribute.
3276
3277         * dom/ContainerNode.cpp:
3278         (WebCore::ContainerNode::childrenChanged): Added call to
3279         invalidateAccessKeyCache, replacing old scheme tied to style recalculation.
3280
3281         * dom/DecodedDataDocumentParser.cpp:
3282         (WebCore::DecodedDataDocumentParser::appendBytes): Update for name and return
3283         type change of createDecoderIfNeeded to decoder.
3284         (WebCore::DecodedDataDocumentParser::flush): Ditto.
3285
3286         * dom/Document.cpp:
3287         (WebCore::Document::elementForAccessKey): Renamed from getElementForAccessKey
3288         to match WebKit coding style. Changed to use unique_ptr instead of separate
3289         boolean to keep track of map validity status.
3290         (WebCore::Document::buildAccessKeyCache): Renamed from buildAccessKeyMap to
3291         clarify that this is a cache. Changed to use composedTreeDescendants rather
3292         than explicit calls to shadowRoot. Use add instead of set so that first element
3293         in document order wins, instead of last element in document order. Updated
3294         to make a new map in a new unique_ptr instead of populating a map.
3295         (WebCore::Document::invalidateAccessKeyCacheSlowCase): Renamed from
3296         invalidateAccessKeyMap, and left an inline part in the header so the fast case
3297         of quickly checking for a null pointer can be inlined.
3298         (WebCore::Document::doctype const): Use downcast instead of static_cast.
3299         (WebCore::Document::scheduleStyleRecalc): Moved call to invalidateAccessKeyMap
3300         from here to childrenChanged and accesskey attribute change handling.
3301         (WebCore::Document::processFormatDetection): Set m_isTelephoneNumberParsingAllowed
3302         directly since this is the only place that does it and we don't need to factor
3303         that one line of code into a function.
3304         (WebCore::Document::getOverrideStyle): Moved to header since it's just a stub
3305         that always returns nullptr and can be inlined.
3306         (WebCore::Document::setIsTelephoneNumberParsingAllowed): Deleted.
3307         (WebCore::Document::ensureTemplateDocument): Removed nullptr frame argument to
3308         the create function, since Document::create now always involves no frame.
3309         (WebCore::Document::didAssociateFormControl): Changed argument type to a reference
3310         and simplified the logic with a local variable.
3311         (WebCore::Document::didAssociateFormControlsTimerFired): Simplified the null
3312         checks and rearranged things so that m_associatedFormControls will always
3313         get cleared even if the document is no longer associated with a page.
3314
3315         * dom/Document.h: Removed unnnecessary explicit values for enumerations (first
3316         value is always zero, etc.) and formatted simple enumerations in a single line
3317         for easier reading. Moved Document::create fucntion bodies out of line, removed
3318         the frame argument from the simple "create with URL" overload and made the frame
3319         argument for createNonRenderedPlaceholder be a reference rather than a pointer.
3320         Renamed getElementByAccessKey to elementForAccessKey, invalidateAccessKeyMap to
3321         invalidateAccessKeyCache, buildAccessKeyMap to buildAccessKeCache,
3322         m_elementsByAccessKey to m_accessKeyCache and changed its type.
3323         Removed bogus "DOM methods" comment, unused setParserFeature friend declaration,
3324         setIsTelephoneNumberParsingAllowed function, and m_accessKeyMapValid flag.
3325
3326         * dom/Document.idl: Added comment highlighting that getOverrideStyle is just a
3327         placeholder returning null.
3328
3329         * dom/Element.cpp:
3330         (WebCore::Element::attributeChanged): Call invalidateAccessKeyCache when the
3331         value of the accesskey attribute is changed. Also moved the class attribute code
3332         so the attributes here are in alphabetical order (only class and id were out of
3333         alphabetical order).
3334
3335         * dom/Node.cpp:
3336         (WebCore::Node::isDescendantOrShadowDescendantOf const): Rewrote to no longer
3337         use deprecatedShadowAncestorNode and used boolean operators to make it a
3338         single line and easier to understand. Also added a FIXME since the
3339         containsIncludingShadowDOM function is so similar, yet differently written.
3340         (WebCore::Node::contains const): Rewrote as a single line to make this easier
3341         to read and to *slightly* improve the speed in the "this == node" case.
3342         (WebCore::Node::containsIncludingHostElements const): Use downcast.
3343         (WebCore::Node::deprecatedShadowAncestorNode const): Deleted.
3344
3345         * dom/Node.h: Deleted now-unused deprecatedShadowAncestorNode.
3346
3347         * editing/ReplaceSelectionCommand.cpp:
3348         (WebCore::ReplacementFragment::ReplacementFragment): Rewrote to use shadowHost
3349         instead of deprecatedShadowAncestorNode.
3350
3351         * html/FormAssociatedElement.cpp:
3352         (WebCore::FormAssociatedElement::resetFormOwner): Pass reference to
3353         didAssociateFormControl.
3354         (WebCore::FormAssociatedElement::formAttributeChanged): Ditto.
3355
3356         * html/HTMLAreaElement.cpp:
3357         (WebCore::HTMLAreaElement::parseAttribute): Removed special case for accesskey
3358         attribute, because we want to call the base class parseAttribute in that case.
3359
3360         * html/HTMLFormElement.cpp:
3361         (WebCore::HTMLFormElement::insertedIntoAncestor): Pass reference to
3362         didAssociateFormControl.
3363
3364         * html/HTMLSelectElement.cpp:
3365         (WebCore::HTMLSelectElement::parseAttribute): Removed special case for accesskey
3366         attribute with mysterious FIXME, because we want to call the base class
3367         parseAttribute in that case. The old code had no effect before; the access key
3368         logic would still find the attribute; if the goal is to ignore the attribute
3369         for these elements we will need a different solution.
3370         * html/HTMLTextAreaElement.cpp:
3371         (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
3372
3373         * loader/DocumentLoader.cpp:
3374         (WebCore::DocumentLoader::DocumentLoader): Removed code that was always passing
3375         nullptr as the frame for the newly created DocumentWriter. It used m_frame, but
3376         m_frame was always null.
3377         (WebCore::DocumentLoader::attachToFrame): Pass reference to DocumentWriter::setFrame.
3378
3379         * loader/DocumentWriter.cpp:
3380         (WebCore::DocumentWriter::DocumentWriter): Deleted. The old version set m_frame to
3381         the passed in frame, which was always nullptr, and initialized some booleans and an
3382         enumeration, which are now initialized in the class definition.
3383         (WebCore::DocumentWriter::createDocument): Pass a reference for the frame.
3384         (WebCore::DocumentWriter::begin): Updated now that State is an enum class.
3385         (WebCore::DocumentWriter::decoder): Renamed from createDecoderIfNeeded and changed
3386         to return a reference.
3387         (WebCore::DocumentWriter::addData): Use RELEASE_ASSERT instead of if/CRASH and
3388         updated now that State is an enum class.
3389         (WebCore::DocumentWriter::insertDataSynchronously): Updated now that State is an
3390         enum class.
3391         (WebCore::DocumentWriter::end): Ditto.
3392
3393         * loader/DocumentWriter.h: Removed unneeded include and forward declaration.
3394         Removed the frame pointer argument to the constructor, caller was always passing a
3395         nullptr. Changed argument to setFrame to be a reference. Renamed createDecoderIfNeeded
3396         to decoder and changed it to return a reference. Initialized m_frame,
3397         m_hasReceivedSomeData, m_encodingWasChosenByUser, and m_state here so we don't need
3398         to initialize them in a constructor. Renamed the enum from WriterState to State since
3399         it's a member of DocumentWriter already, and made it an enum class rather than ending
3400         each enumeration value with WritingState.
3401
3402         * page/DragController.cpp:
3403         (WebCore::isEnabledColorInput): Removed boolean argument setToShadowAncestor. The
3404         one caller that formerly passed true now calls the new hasEnabledColorInputAsShadowHost
3405         function instead.
3406         (WebCore::hasEnabledColorInputAsShadowHost): Added.
3407         (WebCore::elementUnderMouse): Use shadowHost instead of deprecatedShadowAncestorNode.
3408         Also added FIXME since it seems this should instead be using parentElementInComposedTree.
3409         (WebCore::DragController::concludeEditDrag): Removed "false" argument to isEnabledColorInput.
3410         (WebCore::DragController::canProcessDrag): Removed "true" argument to isEnabledColorInput
3411         and added call to hasEnabledColorInputAsShadowHost. Also put the value of the node to drag
3412         into a local variable to simplify code.
3413         (WebCore::DragController::draggableElement const): Removed "false" argument to isEnabledColorInput.
3414
3415         * page/EventHandler.cpp:
3416         (WebCore::EventHandler::handleAccessKey): Update name of elementForAccessKey.
3417
3418         * page/FocusController.cpp:
3419         (WebCore::clearSelectionIfNeeded): Use shadowHost instead of deprecatedShadowAncestorNode.
3420
3421         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3422         (WebCore::createPageForServiceWorker): Pass reference instead of pointer for frame to
3423         Document::createNonRenderedPlaceholder.
3424
3425 2019-02-21  Daniel Bates  <dabates@apple.com>
3426
3427         Same Site Lax cookies are not sent with cross-site redirect from client-initiated load
3428         https://bugs.webkit.org/show_bug.cgi?id=194906
3429         <rdar://problem/44305947>
3430
3431         Reviewed by Brent Fulgham.
3432
3433         Ensure that a request for a top-level navigation is annotated as such regardless of whether
3434         the request has a computed Same Site policy.
3435
3436         "New loads" initiated by a the client (Safari) either by API or a human either explicitly
3437         typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab
3438         are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating
3439         from an existing page. (Command + click should be thought of as a convenience to the user from
3440         having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar).
3441         Currently the frame loader marks a request as a top-level navigation if and only if the request
3442         does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site
3443         policy. So, these loads would never be marked as a top-level navigation by the frame loading code.
3444         Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly
3445         tell the networking stack that the load was a cross-site, non-top-level navigation, and per the
3446         Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead,
3447         WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable.
3448
3449         [1] See Note for (1) in  <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.2>
3450         [2] <https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-5.3.7.1>
3451
3452         Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php
3453
3454         * loader/FrameLoader.cpp:
3455         (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top-
3456         level navigation bit.
3457         * platform/network/ResourceRequestBase.cpp:
3458         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top-
3459         level navigation bit.
3460
3461 2019-02-21  Per Arne Vollan  <pvollan@apple.com>
3462
3463         Layout Test fast/text/international/khmer-selection.html is crashing
3464         https://bugs.webkit.org/show_bug.cgi?id=191368
3465
3466         Reviewed by Brent Fulgham.
3467
3468         GlyphBuffer's offset array wasn't getting filled by UniscribeController.
3469         Our underlining code requires this array.
3470
3471         Uniscribe gives us a character -> glyph mapping, so we just have to compute
3472         the inverse and give it to the GlyphBuffer.
3473
3474         This patch is written by Myles C. Maxfield.
3475
3476         Test: fast/text/international/khmer-selection.html.
3477
3478         * platform/graphics/GlyphBuffer.h:
3479         (WebCore::GlyphBuffer::add):
3480         * platform/graphics/displaylists/DisplayListItems.cpp:
3481         (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const):
3482         * platform/graphics/win/UniscribeController.cpp:
3483         (WebCore::UniscribeController::advance):
3484         (WebCore::UniscribeController::itemizeShapeAndPlace):
3485         (WebCore::UniscribeController::shapeAndPlaceItem):
3486         * platform/graphics/win/UniscribeController.h:
3487
3488 2019-02-21  Sihui Liu  <sihui_liu@apple.com>
3489
3490         IndexedDB: leak UniqueIDBDatabase in layout tests
3491         https://bugs.webkit.org/show_bug.cgi?id=194870
3492         <rdar://problem/48163812>
3493
3494         Reviewed by Geoffrey Garen.
3495
3496         UniqueIDBDatabase owns a pointer to itself after it is hard closed. It should release the pointer when it 
3497         receives confirmation from clients and all pending tasks are done. UniqueIDBDatabase already checks whether the
3498         pointer should be released when a database task finishes, but it didn't perform a check when a confirm message 
3499         is received. 
3500
3501         No new test as the order of task completion and confirmation arrival is uncertain.
3502
3503         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3504         (WebCore::IDBServer::UniqueIDBDatabase::confirmDidCloseFromServer):
3505
3506 2019-02-21  Andy Estes  <aestes@apple.com>
3507
3508         contentfiltering tests leak documents
3509         https://bugs.webkit.org/show_bug.cgi?id=189434
3510         <rdar://44239943>
3511
3512         Reviewed by Simon Fraser.
3513
3514         Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle.
3515
3516         This fixes world leaks in several tests in LayoutTests/contentfiltering/.
3517
3518         * bindings/js/ScriptController.h:
3519         * loader/ContentFilter.cpp:
3520         (WebCore::ContentFilter::didDecide):
3521
3522 2019-02-21  Don Olmstead  <don.olmstead@sony.com>
3523
3524         [CMake][Win] Fix !USE(CF) build of WebCore
3525         https://bugs.webkit.org/show_bug.cgi?id=194879
3526
3527         Reviewed by Konstantin Tokarev.
3528
3529         * PlatformAppleWin.cmake:
3530         * PlatformWin.cmake:
3531         * PlatformWinCairo.cmake:
3532
3533 2019-02-21  Zalan Bujtas  <zalan@apple.com>
3534
3535         [LFC][Floats] Add support for placing formatting roots in-between floats.
3536         https://bugs.webkit.org/show_bug.cgi?id=194902
3537
3538         Reviewed by Antti Koivisto.
3539
3540         This patch add support for placing a formatting root box in-between existing floats.
3541         The initial vertical position of a formatting root is its static position which can make the box
3542         placed above exsiting floats (whereas we can never place a regular float above existing floats.)
3543
3544         Test: fast/block/block-only/floats-and-block-formatting-roots.html
3545
3546         * layout/blockformatting/BlockFormattingContext.cpp:
3547         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
3548         * layout/floats/FloatingContext.cpp:
3549         (WebCore::Layout::FloatPair::LeftRightIndex::isEmpty const):
3550         (WebCore::Layout::FloatPair::isEmpty const):
3551         (WebCore::Layout::FloatPair::operator* const):
3552         (WebCore::Layout::Iterator::operator* const):
3553         (WebCore::Layout::begin):
3554         (WebCore::Layout::end):
3555         (WebCore::Layout::FloatingContext::positionForFloat const):
3556         (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
3557         (WebCore::Layout::findAvailablePosition):
3558         (WebCore::Layout::FloatingContext::findPositionForFloatBox const):
3559         (WebCore::Layout::FloatingContext::findPositionForFormattingContextRoot const):
3560         (WebCore::Layout::FloatPair::FloatPair):
3561         (WebCore::Layout::FloatPair::left const):
3562         (WebCore::Layout::FloatPair::right const):
3563         (WebCore::Layout::FloatPair::intersects const):
3564         (WebCore::Layout::FloatPair::operator == const):
3565         (WebCore::Layout::FloatPair::horizontalConstraints const):
3566         (WebCore::Layout::FloatPair::bottom const):
3567         (WebCore::Layout::Iterator::operator++):
3568         (WebCore::Layout::Iterator::set):
3569         (WebCore::Layout::FloatingPair::isEmpty const): Deleted.
3570         (WebCore::Layout::FloatingPair::verticalConstraint const): Deleted.
3571         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const): Deleted.
3572         (WebCore::Layout::FloatingContext::floatingPosition const): Deleted.
3573         (WebCore::Layout::FloatingPair::FloatingPair): Deleted.
3574         (WebCore::Layout::FloatingPair::left const): Deleted.
3575         (WebCore::Layout::FloatingPair::right const): Deleted.
3576         (WebCore::Layout::FloatingPair::intersects const): Deleted.
3577         (WebCore::Layout::FloatingPair::operator == const): Deleted.
3578         (WebCore::Layout::FloatingPair::horizontalConstraints const): Deleted.
3579         (WebCore::Layout::FloatingPair::bottom const): Deleted.
3580         * layout/floats/FloatingContext.h:
3581
3582 2019-02-21  Rob Buis  <rbuis@igalia.com>
3583
3584         Update MIME type parser
3585         https://bugs.webkit.org/show_bug.cgi?id=180526
3586
3587         Reviewed by Darin Adler.
3588
3589         Further testing showed the MIME parser needs these fixes:
3590         - stripWhitespace is wrong for removing HTTP whitespace, use
3591           stripLeadingAndTrailingHTTPSpaces instead.
3592         - HTTP Token code points checking for Rfc2045 and Mimesniff were
3593           mixed up, use the dedicated isValidHTTPToken for Mimesniff mode.
3594         - Quoted Strings were not unescaped/escaped, this seems ok for
3595           serializing but is wrong when gettings individual parameter values.
3596           Implement [1] and [2] Step 2.4 to properly unescape and escape.
3597
3598         This change also tries to avoid hard to read uses of find.
3599
3600         Test: ParsedContentType.Serialize
3601
3602         [1] https://fetch.spec.whatwg.org/#collect-an-http-quoted-string
3603         [2] https://mimesniff.spec.whatwg.org/#serializing-a-mime-type
3604
3605         * platform/network/ParsedContentType.cpp:
3606         (WebCore::skipSpaces):
3607         (WebCore::parseToken):
3608         (WebCore::isNotQuoteOrBackslash):
3609         (WebCore::collectHTTPQuotedString):
3610         (WebCore::containsNonTokenCharacters):
3611         (WebCore::parseQuotedString):
3612         (WebCore::ParsedContentType::parseContentType):
3613         (WebCore::ParsedContentType::create):
3614         (WebCore::ParsedContentType::setContentType):
3615         (WebCore::containsNonQuoteStringTokenCharacters):
3616         (WebCore::ParsedContentType::setContentTypeParameter):
3617         (WebCore::ParsedContentType::serialize const):
3618         (WebCore::substringForRange): Deleted.
3619         (WebCore::isNonTokenCharacter): Deleted.
3620         (WebCore::isNonQuotedStringTokenCharacter): Deleted.
3621         * platform/network/ParsedContentType.h:
3622
3623 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
3624
3625         REGRESSION (240698): Fixed position banners flicker and move when scrolling on iOS
3626         https://bugs.webkit.org/show_bug.cgi?id=194889
3627         rdar://problem/47755552
3628
3629         Reviewed by Tim Horton.
3630         
3631         After r240698 we could commit scrolling changes for a fixed node where the "viewportRectAtLastLayout" and the layer
3632         position were mismatched; this happened when AsyncScrollingCoordinator::reconcileScrollingState() came back from the UI process
3633         with an unstable update and set a new layoutViewport, then some other layout triggered a compositing tree update. During the tree
3634         update, we'd update the fixed scrolling node with the new viewport, and an old layer position.
3635         
3636         Fix by ensuring that we only update the geometry info for a scrolling tree node when we update layer geometry for the corresponding
3637         layer.
3638
3639         Not currently testable.
3640
3641         * rendering/RenderLayerCompositor.cpp:
3642         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
3643
3644 2019-02-20  Dean Jackson  <dino@apple.com>
3645
3646         Rotation animations sometimes use the wrong origin (affects apple.com)
3647         https://bugs.webkit.org/show_bug.cgi?id=194878
3648         <rdar://problem/43908047>
3649
3650         Reviewed by Simon Fraser.
3651
3652         Some versions of CoreAnimation apply additive animations in reverse
3653         order. Detect this and reverse the list of animations we provide.
3654
3655         Update the existing animations/additive-transform-animations.html test to
3656         be a ref-test that would identify this failure. Previously it relied on
3657         a pixel test.
3658
3659         * platform/graphics/ca/GraphicsLayerCA.cpp: Use 
3660             HAVE_CA_WHERE_ADDITIVE_TRANSFORMS_ARE_REVERSED to decide whether or
3661             not to flip the list of animations (and mark the correct ones as
3662             additive).
3663         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
3664         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
3665
3666 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
3667
3668         [Win] Guard CF usage in RenderThemeWin
3669         https://bugs.webkit.org/show_bug.cgi?id=194875
3670
3671         Reviewed by Alex Christensen.
3672
3673         No new tests. No change in behavior.
3674
3675         Add #if USE(CF) checks to RenderThemeWin so it can compile without CF support.
3676
3677         * rendering/RenderThemeWin.cpp:
3678         (WebCore::RenderThemeWin::stringWithContentsOfFile):
3679         (WebCore::RenderThemeWin::mediaControlsStyleSheet):
3680         (WebCore::RenderThemeWin::mediaControlsScript):
3681         * rendering/RenderThemeWin.h:
3682
3683 2019-02-20  Ryosuke Niwa  <rniwa@webkit.org>
3684
3685         Crash in DOMWindowExtension::suspendForPageCache
3686         https://bugs.webkit.org/show_bug.cgi?id=194871
3687
3688         Reviewed by Chris Dumez.
3689
3690         This is a speculative fix for a crash in DOMWindowExtension::suspendForPageCache.
3691
3692         We think it's possible for DOMWindowExtension::suspendForPageCache notifying the clients via
3693         dispatchWillDisconnectDOMWindowExtensionFromGlobalObject to remove other DOMWindowExtension's.
3694         Check that each DOMWindowProperty is still in m_properties before invoking suspendForPageCache
3695         to avoid the crash.
3696
3697         * page/DOMWindow.cpp:
3698         (WebCore::DOMWindow::willDestroyCachedFrame):
3699         (WebCore::DOMWindow::willDestroyDocumentInFrame):
3700         (WebCore::DOMWindow::willDetachDocumentFromFrame):
3701         (WebCore::DOMWindow::suspendForPageCache):
3702         (WebCore::DOMWindow::resumeFromPageCache):
3703         * page/DOMWindowExtension.cpp:
3704         (WebCore::DOMWindowExtension::suspendForPageCache):
3705
3706 2019-02-20  Alex Christensen  <achristensen@webkit.org>
3707
3708         Always call CompletionHandlers after r240909
3709         https://bugs.webkit.org/show_bug.cgi?id=194823
3710
3711         Reviewed by Ryosuke Niwa.
3712
3713         * loader/PolicyChecker.cpp:
3714         (WebCore::PolicyChecker::checkNavigationPolicy):
3715         (WebCore::PolicyChecker::checkNewWindowPolicy):
3716
3717 2019-02-20  Andy Estes  <aestes@apple.com>
3718
3719         [Xcode] Add SDKVariant.xcconfig to various Xcode projects
3720         https://bugs.webkit.org/show_bug.cgi?id=194869
3721
3722         Rubber-stamped by Jer Noble.
3723
3724         * WebCore.xcodeproj/project.pbxproj:
3725
3726 2019-02-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
3727
3728         drawImage() clears the canvas if it's the source of the image and globalCompositeOperation is "copy"
3729         https://bugs.webkit.org/show_bug.cgi?id=194746
3730
3731         Reviewed by Dean Jackson.
3732
3733         Test: fast/canvas/canvas-drawImage-composite-copy.html
3734
3735         If the source canvas of drawImage() is the same as the destination and
3736         globalCompositeOperation is set to "copy", copy the srcRect from the 
3737         canvas to a temporary buffer before calling clearCanvas() then drawImage
3738         from this temporary buffer.
3739
3740         * html/canvas/CanvasRenderingContext2DBase.cpp:
3741         (WebCore::CanvasRenderingContext2DBase::drawImage):
3742         * platform/graphics/ImageBuffer.cpp:
3743         (WebCore::ImageBuffer::copyRectToBuffer):
3744         * platform/graphics/ImageBuffer.h:
3745
3746 2019-02-20  Simon Fraser  <simon.fraser@apple.com>
3747
3748         REGRESSION (r241788>): ASSERTION FAILED: !m_normalFlowListDirty in TestWebKitAPI.WebKit.ResizeReversePaginatedWebView test
3749         https://bugs.webkit.org/show_bug.cgi?id=194866
3750
3751         Reviewed by Antti Koivisto.
3752
3753         r241788 removed some calls that updated layer lists (normal flow and z-order) during compositing updates, causing
3754         a later call to RenderLayerCompositor::recursiveRepaintLayer() to assert when the lists were dirty. Fix by updating
3755         the lists in RenderLayerCompositor::recursiveRepaintLayer(), as we do in various other places.
3756
3757         * rendering/RenderLayerCompositor.cpp:
3758         (WebCore::RenderLayerCompositor::recursiveRepaintLayer):
3759
3760 2019-02-20  Daniel Bates  <dabates@apple.com>
3761
3762         [iOS] Tweak UI for focus rings
3763         https://bugs.webkit.org/show_bug.cgi?id=194864
3764         <rdar://problem/47831886>
3765
3766         Reviewed by Brent Fulgham.
3767
3768         Make use of UIKit constants to make focus rings pretty.
3769
3770         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3771         (WebCore::drawFocusRingAtTime):
3772
3773 2019-02-20  Timothy Hatcher  <timothy@apple.com>
3774
3775         RenderThemeIOS should use RenderTheme's color cache instead of its own.
3776         https://bugs.webkit.org/show_bug.cgi?id=194822
3777         rdar://problem/48208296
3778
3779         Reviewed by Tim Horton.
3780
3781         Tested by fast/css/apple-system-colors.html.
3782
3783         * css/CSSValueKeywords.in:
3784         * css/parser/CSSPropertyParser.cpp:
3785         (WebCore::isAppleLegacyCssValueKeyword):
3786         * platform/graphics/Color.h:
3787         * platform/graphics/cg/ColorCG.cpp:
3788         (WebCore::makeRGBAFromCGColor):
3789         (WebCore::Color::Color):
3790         * rendering/RenderThemeIOS.h:
3791         * rendering/RenderThemeIOS.mm:
3792         (WebCore::RenderThemeIOS::systemColor const):
3793         * rendering/RenderThemeMac.mm:
3794         (WebCore::RenderThemeMac::systemColor const):
3795
3796 2019-02-20  Loïc Yhuel  <loic.yhuel@softathome.com>
3797
3798         Fix crash when opening Web Inspector after a WebSocket was blocked by content extensions
3799         https://bugs.webkit.org/show_bug.cgi?id=194819
3800
3801         Reviewed by Joseph Pecoraro.
3802
3803         Test: http/tests/inspector/network/contentextensions/blocked-websocket-crash.html
3804
3805         * Modules/websockets/WebSocketChannel.h:
3806         (WebCore::WebSocketChannel::hasCreatedHandshake):
3807         * inspector/agents/page/PageNetworkAgent.cpp:
3808         Ignore WebSocketChannel without an WebSocketHandshake, which would crash in InspectorNetworkAgent::enable.
3809
3810 2019-02-20  Zalan Bujtas  <zalan@apple.com>
3811
3812         [LFC][Floats] Make FloatAvoider::resetPosition implicit
3813         https://bugs.webkit.org/show_bug.cgi?id=194855
3814
3815         Reviewed by Antti Koivisto.
3816
3817         Let's compute the initial top/left position during c'tor time.
3818         This is in preparation for fixing formatting root box placement in a float context.
3819
3820         * layout/floats/FloatAvoider.cpp:
3821         (WebCore::Layout::FloatAvoider::resetPosition): Deleted.
3822         * layout/floats/FloatAvoider.h:
3823         (WebCore::Layout::FloatAvoider::displayBox):
3824         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
3825         * layout/floats/FloatBox.cpp:
3826         (WebCore::Layout::FloatBox::FloatBox):
3827         (WebCore::Layout::FloatBox::initialVerticalPosition const):
3828         * layout/floats/FloatBox.h:
3829         * layout/floats/FloatingContext.cpp:
3830         (WebCore::Layout::FloatingContext::floatingPosition const):
3831
3832 2019-02-20  Don Olmstead  <don.olmstead@sony.com>
3833
3834         [MSVC] Fix compilation errors with lambdas in Service Workers
3835         https://bugs.webkit.org/show_bug.cgi?id=194841
3836
3837         Reviewed by Alex Christensen.
3838
3839         No new tests. No change in behavior.
3840
3841         MSVC has problems with the scoping of `this` within a nested lambda. In these cases `this` is
3842         referring to the enclosing lambda according to MSVC. This patch works around this behavior
3843         through by using the `protectedThis` pattern in WebKit code.
3844
3845         * workers/service/server/RegistrationDatabase.cpp:
3846         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3847
3848 2019-02-20  Adrian Perez de Castro  <aperez@igalia.com>
3849
3850         [WPE][GTK] Enable support for CONTENT_EXTENSIONS
3851         https://bugs.webkit.org/show_bug.cgi?id=167941
3852
3853         Reviewed by Carlos Garcia Campos.
3854
3855         * platform/gtk/po/POTFILES.in: Added WebKitUserContentFilterStore.cpp
3856         to the list of files with translatable strings.
3857
3858 2019-02-19  Simon Fraser  <simon.fraser@apple.com>
3859
3860         REGRESSION (r238090): Toggling visibility on the <html> element can result in a blank web view
3861         https://bugs.webkit.org/show_bug.cgi?id=194827
3862         rdar://problem/47620594
3863
3864         Reviewed by Antti Koivisto.
3865
3866         Incremental compositing updates, added in rr238090, use repaints as a trigger for re-evaluating
3867         layer configurations, since a repaint implies that a layer gains painted content. This is done
3868         via the call to setNeedsCompositingConfigurationUpdate() in RenderLayerBacking::setContentsNeedDisplay{InRect}.
3869         The RenderView's layer is opted out of this to avoid doing lots of redundant layer config recomputation
3870         for the root. The configuration state that matters here is whether the layer contains painted content,
3871         and therefore needs backing store; this is computed by RenderLayerBacking::isSimpleContainerCompositingLayer(),
3872         and feeds into GraphicsLayer::drawsContent().
3873
3874         However, if <html> starts as "visibility:hidden" or "opacity:0", as some sites do to hide incremental loading,
3875         then we'll fail to recompute 'drawsContent' for the root and leave the root with drawsContent=false, which
3876         causes RenderLayerBacking::setContentsNeedDisplay{InRect} to short-circuit, and then we paint nothing.
3877
3878         Ironically, 'drawsContent' doesn't actually save any backing store for the root, since it has no affect on
3879         the root tile caches; we always make tiles. So the simple fix here is to change RenderLayerBacking::isSimpleContainerCompositingLayer()
3880         to always return false for the RenderView's layer (the root).
3881         
3882         Testing this was tricky; ref testing doesn't work because we force repaint, and we normally skip
3883         properties of the root in layer tree dumps to hide WK1/WK2 differences. Therefore I had to add
3884         LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES and fix RenderLayerBacking::shouldDumpPropertyForLayer to
3885         respect it.
3886
3887         Test: compositing/visibility/root-visibility-toggle.html
3888
3889         * page/Frame.h:
3890         * platform/graphics/GraphicsLayer.cpp:
3891         (WebCore::GraphicsLayer::dumpProperties const):
3892         * platform/graphics/GraphicsLayerClient.h:
3893         (WebCore::GraphicsLayerClient::shouldDumpPropertyForLayer const):
3894         * rendering/RenderLayerBacking.cpp:
3895         (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer const):
3896         (WebCore::RenderLayerBacking::shouldDumpPropertyForLayer const):
3897         * rendering/RenderLayerBacking.h:
3898         * rendering/RenderLayerCompositor.cpp:
3899         (WebCore::RenderLayerCompositor::layerTreeAsText):
3900         * testing/Internals.cpp:
3901         (WebCore::toLayerTreeFlags):
3902         * testing/Internals.h:
3903         * testing/Internals.idl:
3904
3905 2019-02-19  Ryosuke Niwa  <rniwa@webkit.org>
3906
3907         REGRESSION(r240909): Release assertion in FrameLoader::loadPostRequest when opening new window
3908         https://bugs.webkit.org/show_bug.cgi?id=194820
3909
3910         Reviewed by Geoffrey Garen.
3911
3912         This release assertion was wrong. The invocation of PolicyChecker::checkNewWindowPolicy in FrameLoader
3913         doesn’t require PolicyChecker's load type to be set in PolicyChecker because FrameLoader's
3914         continueLoadAfterNewWindowPolicy invokes loadWithNavigationAction which sets the load type later,
3915         and we don't rely on PolicyChecker's load type until then.
3916
3917         Fixed the crash by removing relese asserts before invoking checkNewWindowPolicy accordingly.
3918
3919         This patch reverts r241015 since it too was asserting that PolicyChecker's load type is set before
3920         invoking checkNewWindowPolicy which is not the right assumption.
3921
3922         Test: fast/loader/navigate-with-post-to-new-target-after-back-forward-navigation.html
3923
3924         * loader/FrameLoader.cpp:
3925         (WebCore::FrameLoader::loadURL):
3926         (WebCore::FrameLoader::load):
3927         (WebCore::FrameLoader::loadPostRequest):
3928
3929 2019-02-19  Zalan Bujtas  <zalan@apple.com>
3930
3931         Fix post-commit feedback.
3932
3933         Unreviewed. 
3934
3935         * layout/floats/FloatingContext.cpp:
3936         (WebCore::Layout::FloatingPair::intersects const):
3937
3938 2019-02-19  Zalan Bujtas  <zalan@apple.com>
3939
3940         [LFC][Floats] Remove redundant intersecting logic
3941         https://bugs.webkit.org/show_bug.cgi?id=194804
3942
3943         Reviewed by Antti Koivisto.
3944
3945         floatAvoider.overflowsContainingBlock() check already (and properly) takes care of the far left/right case (see comment).
3946
3947         * layout/floats/FloatingContext.cpp:
3948         (WebCore::Layout::FloatingContext::floatingPosition const):
3949         (WebCore::Layout::FloatingPair::intersects const):
3950
3951 2019-02-19&nbs