Commit a38669eb authored by Alberto Garcia's avatar Alberto Garcia

New upstream version 2.30.2

parent 9b544aa3
......@@ -14,7 +14,7 @@
<div class="titlepage">
<div>
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">JavaScriptCore GLib Reference Manual</p></th></tr></table></div>
<div><p class="releaseinfo">for JavaScriptCore 2.30.1</p></div>
<div><p class="releaseinfo">for JavaScriptCore 2.30.2</p></div>
</div>
<hr>
</div>
......
......@@ -175,7 +175,7 @@ have included when compiling your code.</p>
<hr>
<div class="refsect2">
<a name="JSC-MICRO-VERSION:CAPS"></a><h3>JSC_MICRO_VERSION</h3>
<pre class="programlisting">#define JSC_MICRO_VERSION (1)
<pre class="programlisting">#define JSC_MICRO_VERSION (2)
</pre>
</div>
</div>
......
......@@ -14,7 +14,7 @@
<div class="titlepage">
<div>
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">WebKitGTK Reference Manual</p></th></tr></table></div>
<div><p class="releaseinfo">for WebKitGTK 2.30.1</p></div>
<div><p class="releaseinfo">for WebKitGTK 2.30.2</p></div>
</div>
<hr>
</div>
......
......@@ -213,7 +213,7 @@ against at application run time.</p>
<hr>
<div class="refsect2">
<a name="WEBKIT-MICRO-VERSION:CAPS"></a><h3>WEBKIT_MICRO_VERSION</h3>
<pre class="programlisting">#define WEBKIT_MICRO_VERSION (1)
<pre class="programlisting">#define WEBKIT_MICRO_VERSION (2)
</pre>
<p>Like <a class="link" href="webkit2gtk-4.0-WebKitVersion.html#webkit-get-micro-version" title="webkit_get_micro_version ()"><code class="function">webkit_get_micro_version()</code></a>, but from the headers used at
application compile time, rather than from the library linked
......
......@@ -14,7 +14,7 @@
<div class="titlepage">
<div>
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">WebKitDOMGTK+ Reference Manual</p></th></tr></table></div>
<div><p class="releaseinfo">for WebKitDOMGTK+ 2.30.1</p></div>
<div><p class="releaseinfo">for WebKitDOMGTK+ 2.30.2</p></div>
</div>
<hr>
</div>
......
================
WebKitGTK 2.30.2
================
What's new in WebKitGTK 2.30.2?
- Fix scrolling when smooth scrolling is enabled in async scrolling mode.
- Fix WebSocket requests with same-site cookies.
- Fix TLS certificate information for service workers.
- Handle chassis type when its value is quoted.
- Fix the build with ENABLE_MEDIA_STREAM enabled and ENABLE_WEB_RTC_DISABLED.
- Fix the build with ENABLE_GAMEPAD enabled.
- Fix several crashes and rendering issues.
================
WebKitGTK 2.30.1
================
......
......@@ -46,7 +46,12 @@ static Optional<ChassisType> readMachineInfoChassisType()
for (int i = 0; split.get()[i]; ++i) {
if (g_str_has_prefix(split.get()[i], "CHASSIS=")) {
char* chassis = split.get()[i] + 8;
if (!strcmp(chassis, "tablet") || !strcmp(chassis, "handset"))
GUniquePtr<char> unquoted(g_shell_unquote(chassis, &error.outPtr()));
if (error)
g_warning("Could not unquote chassis type %s: %s", chassis, error->message);
if (!strcmp(unquoted.get(), "tablet") || !strcmp(unquoted.get(), "handset"))
return ChassisType::Mobile;
return ChassisType::Desktop;
......
......@@ -1076,6 +1076,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS
platform/gamepad/GamepadProvider.h
platform/gamepad/GamepadProviderClient.h
platform/gamepad/PlatformGamepad.h
platform/gamepad/SharedGamepadValue.h
platform/graphics/AlphaPremultiplication.h
platform/graphics/ANGLEWebKitBridge.h
......
......@@ -33,6 +33,7 @@
#include "ContentRuleListResults.h"
#include "Document.h"
#include "FrameLoader.h"
#include "HTTPHeaderValues.h"
#include "Page.h"
#include "RuntimeEnabledFeatures.h"
......@@ -115,6 +116,7 @@ Optional<ResourceRequest> ThreadableWebSocketChannel::webSocketConnectRequest(Do
request.setAllowCookies(validatedURL->areCookiesAllowed);
request.setFirstPartyForCookies(document.firstPartyForCookies());
request.setHTTPHeaderField(HTTPHeaderName::Origin, document.securityOrigin().toString());
FrameLoader::addSameSiteInfoToRequestIfNeeded(request, &document);
// Add no-cache headers to avoid compatibility issue.
// There are some proxies that rewrite "Connection: upgrade"
......
......@@ -946,6 +946,15 @@ void AsyncScrollingCoordinator::reportSynchronousScrollingReasonsChanged(Monoton
m_page->performanceLoggingClient()->logScrollingEvent(PerformanceLoggingClient::ScrollingEvent::SwitchedScrollingMode, timestamp, reasons.toRaw());
}
#if ENABLE(SMOOTH_SCROLLING)
bool AsyncScrollingCoordinator::scrollAnimatorEnabled() const
{
ASSERT(isMainThread());
auto& settings = m_page->mainFrame().settings();
return settings.scrollAnimatorEnabled();
}
#endif
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING)
......@@ -71,6 +71,10 @@ public:
void reportExposedUnfilledArea(MonotonicTime, unsigned unfilledArea);
void reportSynchronousScrollingReasonsChanged(MonotonicTime, OptionSet<SynchronousScrollingReason>);
#if ENABLE(SMOOTH_SCROLLING)
bool scrollAnimatorEnabled() const;
#endif
protected:
WEBCORE_EXPORT AsyncScrollingCoordinator(Page*);
......
......@@ -257,9 +257,6 @@ void ScrollingTreeScrollingNode::scrollTo(const FloatPoint& position, ScrollType
if (position == m_currentScrollPosition)
return;
if (scrollType == ScrollType::Programmatic)
stopScrollAnimations();
scrollingTree().setIsHandlingProgrammaticScroll(scrollType == ScrollType::Programmatic);
m_currentScrollPosition = adjustedScrollPosition(position, clamp);
......
......@@ -47,6 +47,9 @@ namespace WebCore {
ThreadedScrollingTree::ThreadedScrollingTree(AsyncScrollingCoordinator& scrollingCoordinator)
: m_scrollingCoordinator(&scrollingCoordinator)
{
#if ENABLE(SMOOTH_SCROLLING)
m_scrollAnimatorEnabled = scrollingCoordinator.scrollAnimatorEnabled();
#endif
}
ThreadedScrollingTree::~ThreadedScrollingTree()
......
......@@ -58,6 +58,8 @@ public:
Lock& treeMutex() { return m_treeMutex; }
bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
protected:
explicit ThreadedScrollingTree(AsyncScrollingCoordinator&);
......@@ -101,6 +103,8 @@ private:
// Dynamically allocated because it has to use the ScrollingThread's runloop.
std::unique_ptr<RunLoop::Timer<ThreadedScrollingTree>> m_delayedRenderingUpdateDetectionTimer;
bool m_scrollAnimatorEnabled { false };
};
} // namespace WebCore
......
......@@ -35,11 +35,14 @@
#include "Logging.h"
#include "NicosiaPlatformLayer.h"
#include "ScrollingStateFrameScrollingNode.h"
#include "ScrollingTree.h"
#include "ThreadedScrollingTree.h"
#if ENABLE(KINETIC_SCROLLING)
#include "ScrollAnimationKinetic.h"
#endif
#if ENABLE(SMOOTH_SCROLLING)
#include "ScrollAnimationSmooth.h"
#endif
namespace WebCore {
......@@ -51,20 +54,7 @@ Ref<ScrollingTreeFrameScrollingNode> ScrollingTreeFrameScrollingNodeNicosia::cre
ScrollingTreeFrameScrollingNodeNicosia::ScrollingTreeFrameScrollingNodeNicosia(ScrollingTree& scrollingTree, ScrollingNodeType nodeType, ScrollingNodeID nodeID)
: ScrollingTreeFrameScrollingNode(scrollingTree, nodeType, nodeID)
{
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
[this]() -> ScrollAnimationKinetic::ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()) };
},
[this](FloatPoint&& position) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
});
#endif
m_scrollAnimatorEnabled = downcast<ThreadedScrollingTree>(scrollingTree).scrollAnimatorEnabled();
}
ScrollingTreeFrameScrollingNodeNicosia::~ScrollingTreeFrameScrollingNodeNicosia() = default;
......@@ -109,51 +99,143 @@ void ScrollingTreeFrameScrollingNodeNicosia::commitStateAfterChildren(const Scro
// Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
stopScrollAnimations();
const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->setCurrentPosition(currentScrollPosition());
#endif
}
}
WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
#if ENABLE(KINETIC_SCROLLING)
void ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationKinetic()
{
if (!canHandleWheelEvent(wheelEvent))
return WheelEventHandlingResult::unhandled();
if (m_kineticAnimation)
return;
if (wheelEvent.deltaX() || wheelEvent.deltaY()) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
[this]() -> ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
},
[this](FloatPoint&& position) {
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->setCurrentPosition(position);
#endif
auto updateScope = compositionLayer.createUpdateScope();
scrollBy({ -wheelEvent.deltaX(), -wheelEvent.deltaY() });
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
}
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
});
}
#endif
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation->appendToScrollHistory(wheelEvent);
#if ENABLE(SMOOTH_SCROLLING)
void ScrollingTreeFrameScrollingNodeNicosia::ensureScrollAnimationSmooth()
{
if (m_smoothAnimation)
return;
m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
[this]() -> ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
},
currentScrollPosition(),
[this](FloatPoint&& position) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
},
[] { });
}
#endif
WheelEventHandlingResult ScrollingTreeFrameScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
if (!canHandleWheelEvent(wheelEvent))
return WheelEventHandlingResult::unhandled();
#if ENABLE(KINETIC_SCROLLING)
ensureScrollAnimationKinetic();
m_kineticAnimation->appendToScrollHistory(wheelEvent);
m_kineticAnimation->stop();
if (wheelEvent.isEndOfNonMomentumScroll()) {
m_kineticAnimation->start(currentScrollPosition(), m_kineticAnimation->computeVelocity(), canHaveHorizontalScrollbar(), canHaveVerticalScrollbar());
m_kineticAnimation->clearScrollHistory();
return WheelEventHandlingResult::handled();
}
if (wheelEvent.isTransitioningToMomentumScroll()) {
m_kineticAnimation->start(currentScrollPosition(), wheelEvent.swipeVelocity(), canHaveHorizontalScrollbar(), canHaveVerticalScrollbar());
m_kineticAnimation->clearScrollHistory();
return WheelEventHandlingResult::handled();
}
#endif
// FIXME: This needs to return whether the event was handled.
float deltaX = canHaveHorizontalScrollbar() ? wheelEvent.deltaX() : 0;
float deltaY = canHaveVerticalScrollbar() ? wheelEvent.deltaY() : 0;
if ((deltaX < 0 && currentScrollPosition().x() >= maximumScrollPosition().x())
|| (deltaX > 0 && currentScrollPosition().x() <= minimumScrollPosition().x()))
deltaX = 0;
if ((deltaY < 0 && currentScrollPosition().y() >= maximumScrollPosition().y())
|| (deltaY > 0 && currentScrollPosition().y() <= minimumScrollPosition().y()))
deltaY = 0;
if (!deltaX && !deltaY)
return WheelEventHandlingResult::unhandled();
if (wheelEvent.granularity() == ScrollByPageWheelEvent) {
if (deltaX) {
bool negative = deltaX < 0;
deltaX = Scrollbar::pageStepDelta(scrollableAreaSize().width());
if (negative)
deltaX = -deltaX;
}
if (deltaY) {
bool negative = deltaY < 0;
deltaY = Scrollbar::pageStepDelta(scrollableAreaSize().height());
if (negative)
deltaY = -deltaY;
}
}
#if ENABLE(SMOOTH_SCROLLING)
if (m_scrollAnimatorEnabled && !wheelEvent.hasPreciseScrollingDeltas()) {
ensureScrollAnimationSmooth();
m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
return WheelEventHandlingResult::handled();
}
#endif
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollBy({ -deltaX, -deltaY });
return WheelEventHandlingResult::handled();
}
void ScrollingTreeFrameScrollingNodeNicosia::stopScrollAnimations()
{
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation->stop();
m_kineticAnimation->clearScrollHistory();
if (m_kineticAnimation) {
m_kineticAnimation->stop();
m_kineticAnimation->clearScrollHistory();
}
#endif
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->stop();
#endif
}
......@@ -232,6 +314,11 @@ void ScrollingTreeFrameScrollingNodeNicosia::repositionRelatedLayers()
if (m_footerLayer)
applyLayerPosition(*m_footerLayer, FloatPoint(horizontalScrollOffsetForBanner, FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, totalContentsSize().height(), footerHeight())));
}
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->updateVisibleLengths();
#endif
}
} // namespace WebCore
......
......@@ -39,6 +39,7 @@ class CompositionLayer;
}
namespace WebCore {
class ScrollAnimation;
class ScrollAnimationKinetic;
class ScrollingTreeFrameScrollingNodeNicosia final : public ScrollingTreeFrameScrollingNode {
......@@ -52,6 +53,13 @@ private:
void commitStateBeforeChildren(const ScrollingStateNode&) override;
void commitStateAfterChildren(const ScrollingStateNode&) override;
#if ENABLE(KINETIC_SCROLLING)
void ensureScrollAnimationKinetic();
#endif
#if ENABLE(SMOOTH_SCROLLING)
void ensureScrollAnimationSmooth();
#endif
WheelEventHandlingResult handleWheelEvent(const PlatformWheelEvent&) override;
void stopScrollAnimations() override;
......@@ -70,9 +78,13 @@ private:
RefPtr<Nicosia::CompositionLayer> m_headerLayer;
RefPtr<Nicosia::CompositionLayer> m_footerLayer;
bool m_scrollAnimatorEnabled { false };
#if ENABLE(KINETIC_SCROLLING)
std::unique_ptr<ScrollAnimationKinetic> m_kineticAnimation;
#endif
#if ENABLE(SMOOTH_SCROLLING)
std::unique_ptr<ScrollAnimation> m_smoothAnimation;
#endif
};
} // namespace WebCore
......
......@@ -35,8 +35,11 @@
#if ENABLE(KINETIC_SCROLLING)
#include "ScrollAnimationKinetic.h"
#endif
#if ENABLE(SMOOTH_SCROLLING)
#include "ScrollAnimationSmooth.h"
#endif
#include "ScrollingStateOverflowScrollingNode.h"
#include "ScrollingTree.h"
#include "ThreadedScrollingTree.h"
namespace WebCore {
......@@ -48,20 +51,7 @@ Ref<ScrollingTreeOverflowScrollingNode> ScrollingTreeOverflowScrollingNodeNicosi
ScrollingTreeOverflowScrollingNodeNicosia::ScrollingTreeOverflowScrollingNodeNicosia(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
: ScrollingTreeOverflowScrollingNode(scrollingTree, nodeID)
{
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
[this]() -> ScrollAnimationKinetic::ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()) };
},
[this](FloatPoint&& position) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrolledContentsLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
});
#endif
m_scrollAnimatorEnabled = downcast<ThreadedScrollingTree>(scrollingTree).scrollAnimatorEnabled();
}
ScrollingTreeOverflowScrollingNodeNicosia::~ScrollingTreeOverflowScrollingNodeNicosia() = default;
......@@ -72,8 +62,13 @@ void ScrollingTreeOverflowScrollingNodeNicosia::commitStateAfterChildren(const S
const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
if (overflowStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
stopScrollAnimations();
const auto& requestedScrollData = overflowStateNode.requestedScrollData();
scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->setCurrentPosition(currentScrollPosition());
#endif
}
}
......@@ -97,46 +92,140 @@ void ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers()
state.boundsOrigin = scrollOffset;
state.delta.boundsOriginChanged = true;
});
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->updateVisibleLengths();
#endif
}
WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
#if ENABLE(KINETIC_SCROLLING)
void ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationKinetic()
{
if (!canHandleWheelEvent(wheelEvent))
return WheelEventHandlingResult::unhandled();
if (m_kineticAnimation)
return;
if (wheelEvent.deltaX() || wheelEvent.deltaY()) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
m_kineticAnimation = makeUnique<ScrollAnimationKinetic>(
[this]() -> ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
},
[this](FloatPoint&& position) {
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->setCurrentPosition(position);
#endif
auto updateScope = compositionLayer.createUpdateScope();
scrollBy({ -wheelEvent.deltaX(), -wheelEvent.deltaY() });
}
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation->appendToScrollHistory(wheelEvent);
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
});
}
#endif
#if ENABLE(SMOOTH_SCROLLING)
void ScrollingTreeOverflowScrollingNodeNicosia::ensureScrollAnimationSmooth()
{
if (m_smoothAnimation)
return;
m_smoothAnimation = makeUnique<ScrollAnimationSmooth>(
[this]() -> ScrollExtents {
return { IntPoint(minimumScrollPosition()), IntPoint(maximumScrollPosition()), IntSize(scrollableAreaSize()) };
},
currentScrollPosition(),
[this](FloatPoint&& position) {
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollTo(position);
},
[] { });
}
#endif
WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeNicosia::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
{
if (!canHandleWheelEvent(wheelEvent))
return WheelEventHandlingResult::unhandled();
#if ENABLE(KINETIC_SCROLLING)
ensureScrollAnimationKinetic();
m_kineticAnimation->appendToScrollHistory(wheelEvent);
m_kineticAnimation->stop();
if (wheelEvent.isEndOfNonMomentumScroll()) {
m_kineticAnimation->start(currentScrollPosition(), m_kineticAnimation->computeVelocity(), canHaveHorizontalScrollbar(), canHaveVerticalScrollbar());
m_kineticAnimation->clearScrollHistory();
return WheelEventHandlingResult::handled();
}
if (wheelEvent.isTransitioningToMomentumScroll()) {
m_kineticAnimation->start(currentScrollPosition(), wheelEvent.swipeVelocity(), canHaveHorizontalScrollbar(), canHaveVerticalScrollbar());
m_kineticAnimation->clearScrollHistory();
return WheelEventHandlingResult::handled();
}
#endif
float deltaX = canHaveHorizontalScrollbar() ? wheelEvent.deltaX() : 0;
float deltaY = canHaveVerticalScrollbar() ? wheelEvent.deltaY() : 0;
if ((deltaX < 0 && currentScrollPosition().x() >= maximumScrollPosition().x())
|| (deltaX > 0 && currentScrollPosition().x() <= minimumScrollPosition().x()))
deltaX = 0;
if ((deltaY < 0 && currentScrollPosition().y() >= maximumScrollPosition().y())
|| (deltaY > 0 && currentScrollPosition().y() <= minimumScrollPosition().y()))
deltaY = 0;
if (!deltaX && !deltaY)
return WheelEventHandlingResult::unhandled();
if (wheelEvent.granularity() == ScrollByPageWheelEvent) {
if (deltaX) {
bool negative = deltaX < 0;
deltaX = Scrollbar::pageStepDelta(scrollableAreaSize().width());
if (negative)
deltaX = -deltaX;
}
if (deltaY) {
bool negative = deltaY < 0;
deltaY = Scrollbar::pageStepDelta(scrollableAreaSize().height());
if (negative)
deltaY = -deltaY;
}
}
#if ENABLE(SMOOTH_SCROLLING)
if (m_scrollAnimatorEnabled && !wheelEvent.hasPreciseScrollingDeltas()) {
ensureScrollAnimationSmooth();
m_smoothAnimation->scroll(HorizontalScrollbar, ScrollByPixel, 1, -deltaX);
m_smoothAnimation->scroll(VerticalScrollbar, ScrollByPixel, 1, -deltaY);
return WheelEventHandlingResult::handled();
}
#endif
auto* scrollLayer = static_cast<Nicosia::PlatformLayer*>(scrollContainerLayer());
ASSERT(scrollLayer);
auto& compositionLayer = downcast<Nicosia::CompositionLayer>(*scrollLayer);
auto updateScope = compositionLayer.createUpdateScope();
scrollBy({ -deltaX, -deltaY });
return WheelEventHandlingResult::handled();
}
void ScrollingTreeOverflowScrollingNodeNicosia::stopScrollAnimations()
{
#if ENABLE(KINETIC_SCROLLING)
m_kineticAnimation->stop();
m_kineticAnimation->clearScrollHistory();
if (m_kineticAnimation) {
m_kineticAnimation->stop();
m_kineticAnimation->clearScrollHistory();
}
#endif
#if ENABLE(SMOOTH_SCROLLING)
if (m_smoothAnimation)
m_smoothAnimation->stop();
#endif
}
......
......@@ -33,6 +33,7 @@
#include "ScrollingTreeOverflowScrollingNode.h"
namespace WebCore {
class ScrollAnimation;
class ScrollAnimationKinetic;
class ScrollingTreeOverflowScrollingNodeNicosia final : public ScrollingTreeOverflowScrollingNode {
......@@ -49,13 +50,24 @@ private:
void repositionScrollingLayers() override;
#if ENABLE(KINETIC_SCROLLING)
void ensureScrollAnimationKinetic();
#endif
#if ENABLE(SMOOTH_SCROLLING)
void ensureScrollAnimationSmooth();
#endif