http://bugs.webkit.org/show_bug.cgi?id=11096
Hit testing for polylines fails
Fix Path::contains so it handles filled, non-closed paths too.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16688
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-30 Rob Buis <buis@kde.org>
+
+ Reviewed by eseidel.
+
+ Testcase for:
+ http://bugs.webkit.org/show_bug.cgi?id=11096
+ Hit testing for polylines fails
+
+ * svg/custom/polyline-hittest-expected.checksum: Added.
+ * svg/custom/polyline-hittest-expected.png: Added.
+ * svg/custom/polyline-hittest-expected.txt: Added.
+ * svg/custom/polyline-hittest.svg: Added.
+
2006-09-29 Timothy Hatcher <timothy@apple.com>
Bug 11041: fast/dom/isindex-001 needs new results
--- /dev/null
+16310588467cfc20d551635abc59b784
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:(null) affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+ KCanvasContainer {svg} at (0,0) size 100x100
+ KCanvasItem {polyline} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg" onload="click()">
+ <script type="text/javascript">
+ <![CDATA[
+
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+ function changeFill(evt) {
+ var poly = evt.target;
+ poly.setAttribute("fill", "green");
+ }
+
+ function click() {
+ if (window.eventSender) {
+ // Fill click
+ eventSender.mouseMoveTo(25, 25);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ ]]>
+ </script>
+
+ <polyline onclick="changeFill(evt);" points="0 0 100 0 100 100 0 100" fill="red"/>
+</svg>
+2006-09-30 Rob Buis <buis@kde.org>
+
+ Reviewed by eseidel.
+
+ http://bugs.webkit.org/show_bug.cgi?id=11096
+ Hit testing for polylines fails
+
+ Fix Path::contains so it handles filled, non-closed paths too.
+
+ * platform/cg/PathCG.cpp:
+ (WebCore::Path::contains):
+
2006-09-30 Dave Hyatt <hyatt@apple.com>
Refactor subframe event handling to hide more of the Mac-specific logic from the cross-platform code.
#if PLATFORM(CG)
-#include "FloatRect.h"
-#include "PlatformString.h"
#include "AffineTransform.h"
#include <ApplicationServices/ApplicationServices.h>
+#include "FloatRect.h"
+#include "IntRect.h"
+#include "PlatformString.h"
namespace WebCore {
bool Path::contains(const FloatPoint &point, WindRule rule) const
{
- return CGPathContainsPoint(m_path, 0, point, rule == RULE_EVENODD ? true : false);
+ // CGPathContainsPoint returns false for non-closed paths, as a work-around, we copy and close the path first. Radar 4758998 asks for a better CG API to use
+ if (!enclosingIntRect(boundingRect()).contains(point.x(), point.y()))
+ return false;
+
+ CGMutablePathRef path = CGPathCreateMutableCopy(m_path);
+ CGPathCloseSubpath(path);
+ bool ret = CGPathContainsPoint(path, 0, point, rule == RULE_EVENODD ? true : false);
+ CGPathRelease(path);
+ return ret;
}
void Path::translate(const FloatSize& size)