Diff
Modified: trunk/LayoutTests/ChangeLog (260614 => 260615)
--- trunk/LayoutTests/ChangeLog 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/LayoutTests/ChangeLog 2020-04-24 01:08:44 UTC (rev 260615)
@@ -1,3 +1,18 @@
+2020-04-23 Simon Fraser <[email protected]>
+
+ EventHandler::selectCursor() has broken resize over coordinate conversion code
+ https://bugs.webkit.org/show_bug.cgi?id=210778
+
+ Reviewed by Zalan Bujtas.
+
+ * TestExpectations:
+ * fast/events/cursors/mouse-cursor-over-resizer-expected.txt: Added.
+ * fast/events/cursors/mouse-cursor-over-resizer.html: Added.
+ * fast/events/mouse-cursor-change.html:
+ * platform/mac-wk2/TestExpectations:
+ * resources/ui-helper.js:
+ (window.UIHelper.async moveMouseAndWaitForFrame):
+
2020-04-23 Devin Rousso <[email protected]>
Web Insspector: Storage: cannot select multiple local storage entries
Modified: trunk/LayoutTests/TestExpectations (260614 => 260615)
--- trunk/LayoutTests/TestExpectations 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/LayoutTests/TestExpectations 2020-04-24 01:08:44 UTC (rev 260615)
@@ -43,6 +43,7 @@
fast/viewport/ios [ Skip ]
fast/visual-viewport/ios/ [ Skip ]
fast/device-orientation [ Skip ]
+fast/events/cursors [ Skip ]
fast/events/ios [ Skip ]
fast/events/watchos [ Skip ]
fast/events/pointer/ios [ Skip ]
Added: trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer-expected.txt (0 => 260615)
--- trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer-expected.txt 2020-04-24 01:08:44 UTC (rev 260615)
@@ -0,0 +1,12 @@
+Tests that the mouse cursor updates over the resize control.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.getCurrentCursorInfo() is "type=Pointer hotSpot=0,0"
+PASS internals.getCurrentCursorInfo() is "type=SouthEastResize hotSpot=0,0"
+PASS internals.getCurrentCursorInfo() is "type=SouthWestResize hotSpot=0,0"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer.html (0 => 260615)
--- trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer.html (rev 0)
+++ trunk/LayoutTests/fast/events/cursors/mouse-cursor-over-resizer.html 2020-04-24 01:08:44 UTC (rev 260615)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .target {
+ margin: 10px;
+ overflow: hidden;
+ width: 200px;
+ height: 100px;
+ resize: both;
+ border: 12px solid silver;
+ }
+ #rtl-target {
+ direction: rtl;
+ }
+ </style>
+ <script src=""
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ const borderWidth = 12;
+
+ window.addEventListener('load', async () => {
+ description("Tests that the mouse cursor updates over the resize control.");
+
+ await UIHelper.moveMouseAndWaitForFrame(2, 2);
+ shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=Pointer hotSpot=0,0');
+
+ let target = document.getElementById('target');
+ let targetBounds = target.getBoundingClientRect();
+ await UIHelper.moveMouseAndWaitForFrame(targetBounds.right - borderWidth - 4, targetBounds.bottom - borderWidth - 4);
+ shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=SouthEastResize hotSpot=0,0');
+
+ target = document.getElementById('rtl-target');
+ targetBounds = target.getBoundingClientRect();
+ await UIHelper.moveMouseAndWaitForFrame(targetBounds.left + borderWidth + 4, targetBounds.bottom - borderWidth - 4);
+ shouldBeEqualToString('internals.getCurrentCursorInfo()', 'type=SouthWestResize hotSpot=0,0');
+
+ document.getElementById('test-container').remove();
+ finishJSTest();
+ }, false);
+ </script>
+</head>
+<body>
+ <div id="test-container">
+ <div id="target" class="target">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ </div>
+
+ <div id="rtl-target" class="target">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ </div>
+ </div>
+ <div id="console"></div>
+ <script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/events/mouse-cursor-change.html (260614 => 260615)
--- trunk/LayoutTests/fast/events/mouse-cursor-change.html 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/LayoutTests/fast/events/mouse-cursor-change.html 2020-04-24 01:08:44 UTC (rev 260615)
@@ -2,8 +2,6 @@
<html>
<head>
<script src=""
-<style type="text/css">
-</style>
</head>
<body>
<p id="description"></p>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (260614 => 260615)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-04-24 01:08:44 UTC (rev 260615)
@@ -11,6 +11,7 @@
editing/find [ Pass ]
editing/undo-manager [ Pass ]
editing/pasteboard/dom-paste [ Pass ]
+fast/events/cursors [ Pass ]
fast/forms/select/mac-wk2 [ Pass ]
fast/sandbox/mac [ Pass ]
fast/scrolling/mac [ Pass ]
Modified: trunk/LayoutTests/resources/ui-helper.js (260614 => 260615)
--- trunk/LayoutTests/resources/ui-helper.js 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/LayoutTests/resources/ui-helper.js 2020-04-24 01:08:44 UTC (rev 260615)
@@ -29,6 +29,12 @@
eventSender.mouseUp();
}
+ static async moveMouseAndWaitForFrame(x, y)
+ {
+ eventSender.mouseMoveTo(x, y);
+ await UIHelper.animationFrame();
+ }
+
static async mouseWheelScrollAt(x, y, beginX, beginY, deltaX, deltaY)
{
if (beginX === undefined)
Modified: trunk/Source/WebCore/ChangeLog (260614 => 260615)
--- trunk/Source/WebCore/ChangeLog 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/Source/WebCore/ChangeLog 2020-04-24 01:08:44 UTC (rev 260615)
@@ -1,3 +1,32 @@
+2020-04-23 Simon Fraser <[email protected]>
+
+ EventHandler::selectCursor() has broken resize over coordinate conversion code
+ https://bugs.webkit.org/show_bug.cgi?id=210778
+
+ Reviewed by Zalan Bujtas.
+
+ EventHandler::selectCursor() appeared to make a local hit-test point from window
+ to content coordinates, which made no sense, but this happened to work because
+ RenderLayer::hitTestLayer() set the HitTestResult localPoint to a global point
+ if you hit the resizer.
+
+ Clean up this mess by having all resizer-related geometry queries be in local coordinates.
+
+ As a bonus, actually set the cursor to a resize cursor when over the resizer.
+
+ Test: fast/events/cursors/mouse-cursor-over-resizer.html
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::selectCursor):
+ (WebCore::EventHandler::handleMousePressEvent):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::resize):
+ (WebCore::RenderLayer::offsetFromResizeCorner const):
+ (WebCore::RenderLayer::isPointInResizeControl const):
+ (WebCore::RenderLayer::hitTestLayer):
+ (WebCore::RenderLayer::hitTestResizerInFragments const):
+ * rendering/RenderLayer.h:
+
2020-04-23 Wenson Hsieh <[email protected]>
Text manipulation does not account for text in fully clipped containers
Modified: trunk/Source/WebCore/page/EventHandler.cpp (260614 => 260615)
--- trunk/Source/WebCore/page/EventHandler.cpp 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2020-04-24 01:08:44 UTC (rev 260615)
@@ -1542,10 +1542,12 @@
return handCursor();
bool inResizer = false;
- if (renderer) {
- if (RenderLayer* layer = renderer->enclosingLayer()) {
- if (FrameView* view = m_frame.view())
- inResizer = layer->isPointInResizeControl(view->windowToContents(roundedIntPoint(result.localPoint()))); // This coordinate conversion is wrong: webkit.org/b/210778.
+ if (renderer && renderer->hasLayer()) {
+ // FIXME: With right-aligned text in a box, the renderer here is usually a RenderText, which prevents showing the resize cursor: webkit.org/b/210935.
+ if (auto* layer = downcast<RenderLayerModelObject>(*renderer).layer()) {
+ inResizer = layer->isPointInResizeControl(roundedIntPoint(result.localPoint()));
+ if (inResizer)
+ return layer->shouldPlaceBlockDirectionScrollbarOnLeft() ? southWestResizeCursor() : southEastResizeCursor();
}
}
@@ -1785,12 +1787,12 @@
}
if (FrameView* view = m_frame.view()) {
- RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()->enclosingLayer() : 0;
- IntPoint p = view->windowToContents(platformMouseEvent.position());
- if (layer && layer->isPointInResizeControl(p)) {
+ RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()->enclosingLayer() : nullptr;
+ auto localPoint = roundedIntPoint(mouseEvent.hitTestResult().localPoint());
+ if (layer && layer->isPointInResizeControl(localPoint)) {
layer->setInResizeMode(true);
m_resizeLayer = layer;
- m_offsetFromResizeCorner = layer->offsetFromResizeCorner(p);
+ m_offsetFromResizeCorner = layer->offsetFromResizeCorner(localPoint);
invalidateClick();
return true;
}
Modified: trunk/Source/WebCore/platform/Cursor.cpp (260614 => 260615)
--- trunk/Source/WebCore/platform/Cursor.cpp 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/Source/WebCore/platform/Cursor.cpp 2020-04-24 01:08:44 UTC (rev 260615)
@@ -152,10 +152,6 @@
: m_type(Custom)
, m_image(image)
, m_hotSpot(determineHotSpot(image, hotSpot))
-#if ENABLE(MOUSE_CURSOR_SCALE)
- , m_imageScaleFactor(1)
-#endif
- , m_platformCursor(0)
{
}
@@ -165,7 +161,6 @@
, m_image(image)
, m_hotSpot(determineHotSpot(image, hotSpot))
, m_imageScaleFactor(scale)
- , m_platformCursor(0)
{
}
#endif
@@ -172,10 +167,6 @@
Cursor::Cursor(Type type)
: m_type(type)
-#if ENABLE(MOUSE_CURSOR_SCALE)
- , m_imageScaleFactor(1)
-#endif
- , m_platformCursor(0)
{
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (260614 => 260615)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-04-24 01:08:44 UTC (rev 260615)
@@ -3077,7 +3077,10 @@
float zoomFactor = renderer->style().effectiveZoom();
- LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToContents(evt.position()));
+ auto absolutePoint = document.view()->windowToContents(evt.position());
+ auto localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
+
+ LayoutSize newOffset = offsetFromResizeCorner(localPoint);
newOffset.setWidth(newOffset.width() / zoomFactor);
newOffset.setHeight(newOffset.height() / zoomFactor);
@@ -3663,16 +3666,11 @@
return m_hBar->height();
}
-IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& absolutePoint) const
+IntSize RenderLayer::offsetFromResizeCorner(const IntPoint& localPoint) const
{
- // Currently the resize corner is either the bottom right corner or the bottom left corner.
- // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
- IntSize elementSize = size();
- if (shouldPlaceBlockDirectionScrollbarOnLeft())
- elementSize.setWidth(0);
- IntPoint resizerPoint = IntPoint(elementSize);
- IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
- return localPoint - resizerPoint;
+ auto resizerRect = overflowControlsRects().resizer;
+ auto resizeCorner = shouldPlaceBlockDirectionScrollbarOnLeft() ? resizerRect.minXMaxYCorner() : resizerRect.maxXMaxYCorner();
+ return localPoint - resizeCorner;
}
bool RenderLayer::hasOverflowControls() const
@@ -4119,15 +4117,12 @@
}
}
-bool RenderLayer::isPointInResizeControl(const IntPoint& absolutePoint) const
+bool RenderLayer::isPointInResizeControl(IntPoint localPoint) const
{
if (!canResize())
return false;
- auto rects = overflowControlsRects();
-
- IntPoint localPoint = roundedIntPoint(absoluteToContents(absolutePoint));
- return rects.resizer.contains(localPoint);
+ return overflowControlsRects().resizer.contains(localPoint);
}
bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
@@ -5446,8 +5441,9 @@
collectFragments(layerFragments, rootLayer, hitTestRect, IncludeCompositedPaginatedLayers, RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip,
offsetFromAncestor(rootLayer));
- if (canResize() && hitTestResizerInFragments(layerFragments, hitTestLocation)) {
- renderer().updateHitTestResult(result, hitTestLocation.point());
+ LayoutPoint localPoint;
+ if (canResize() && hitTestResizerInFragments(layerFragments, hitTestLocation, localPoint)) {
+ renderer().updateHitTestResult(result, localPoint);
return this;
}
@@ -5521,7 +5517,7 @@
return false;
}
-bool RenderLayer::hitTestResizerInFragments(const LayerFragments& layerFragments, const HitTestLocation& hitTestLocation) const
+bool RenderLayer::hitTestResizerInFragments(const LayerFragments& layerFragments, const HitTestLocation& hitTestLocation, LayoutPoint& pointInFragment) const
{
if (layerFragments.isEmpty())
return false;
@@ -5541,10 +5537,12 @@
for (int i = layerFragments.size() - 1; i >= 0; --i) {
const LayerFragment& fragment = layerFragments.at(i);
auto resizerRectInFragment = cornerRectInFragment(snappedIntRect(fragment.layerBounds), rects.resizer);
- if (fragment.backgroundRect.intersects(hitTestLocation) && resizerRectInFragment.contains(hitTestLocation.roundedPoint()))
+ if (fragment.backgroundRect.intersects(hitTestLocation) && resizerRectInFragment.contains(hitTestLocation.roundedPoint())) {
+ pointInFragment = toLayoutPoint(hitTestLocation.point() - fragment.layerBounds.location());
return true;
+ }
}
-
+
return false;
}
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (260614 => 260615)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2020-04-24 01:08:37 UTC (rev 260614)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2020-04-24 01:08:44 UTC (rev 260615)
@@ -521,9 +521,9 @@
int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
bool hasOverflowControls() const;
- bool isPointInResizeControl(const IntPoint& absolutePoint) const;
+ bool isPointInResizeControl(IntPoint localPoint) const;
bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
- IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
+ IntSize offsetFromResizeCorner(const IntPoint& localPoint) const;
void paintOverflowControls(GraphicsContext&, const IntPoint&, const IntRect& damageRect, bool paintingOverlayControls = false);
void paintScrollCorner(GraphicsContext&, const IntPoint&, const IntRect& damageRect);
@@ -1095,7 +1095,7 @@
bool hitTestContents(const HitTestRequest&, HitTestResult&, const LayoutRect& layerBounds, const HitTestLocation&, HitTestFilter) const;
bool hitTestContentsForFragments(const LayerFragments&, const HitTestRequest&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
- bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&) const;
+ bool hitTestResizerInFragments(const LayerFragments&, const HitTestLocation&, LayoutPoint& pointInFragment) const;
RenderLayer* hitTestTransformedLayerInFragments(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest&, HitTestResult&,
const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = nullptr, double* zOffset = nullptr);