Bug 23943 - Implement WebKitPoint and APIs to map points through transforms
Summary: Implement WebKitPoint and APIs to map points through transforms
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Chris Marrin
URL:
Keywords: InRadar
Depends on:
Blocks: 23359
  Show dependency treegraph
 
Reported: 2009-02-12 22:25 PST by Simon Fraser (smfr)
Modified: 2009-03-02 11:51 PST (History)
2 users (show)

See Also:


Attachments
Patch with test (41.92 KB, patch)
2009-02-24 17:26 PST, Chris Marrin
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2009-02-12 22:25:45 PST
We need to add a 'point' object (WebKitPoint) and a way to map points through possibly-transformed elements.
Comment 1 Chris Marrin 2009-02-24 17:26:55 PST
Created attachment 27944 [details]
Patch with test
Comment 2 Simon Fraser (smfr) 2009-02-24 17:41:24 PST
Comment on attachment 27944 [details]
Patch with test

> Index: WebCore/WebCore.vcproj/WebCore.vcproj
> ===================================================================

>  			<File
> +				RelativePath="..\page\WebKitPoint.cpp"
> +				>
> +				<FileConfiguration

Don't include the FileConfiguration hunks

> Index: WebCore/WebCore.xcodeproj/project.pbxproj
> ===================================================================

> +		494BD51E0F53721D00747828 /* WebKitPoint.idl in Resources */ = {isa = PBXBuildFile; fileRef = 494BD51C0F53721C00747828 /* WebKitPoint.idl */; };

Please remove the idl from Resources.

> Index: WebCore/bindings/js/JSWebKitPointConstructor.cpp
> ===================================================================
> --- WebCore/bindings/js/JSWebKitPointConstructor.cpp	(revision 0)
> +++ WebCore/bindings/js/JSWebKitPointConstructor.cpp	(revision 0)
> @@ -0,0 +1,61 @@
> +/*
> + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Library General Public
> + * License as published by the Free Software Foundation; either
> + * version 2 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Library General Public License for more details.
> + *
> + * You should have received a copy of the GNU Library General Public License
> + * along with this library; see the file COPYING.LIB.  If not, write to
> + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> + * Boston, MA 02110-1301, USA.
> + */

Apple license, not LGPL please.

> Index: WebCore/bindings/js/JSWebKitPointConstructor.h
> ===================================================================
> --- WebCore/bindings/js/JSWebKitPointConstructor.h	(revision 0)
> +++ WebCore/bindings/js/JSWebKitPointConstructor.h	(revision 0)
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.

2009

> Index: WebCore/page/DOMWindow.cpp
> ===================================================================

> +PassRefPtr<WebKitPoint> DOMWindow::webkitConvertPointFromNodeToPage(Node* node, const WebKitPoint* p) const
> +{
> +    if (!node || !p)
> +        return 0;
> +        
> +    FloatPoint pp(p->x(), p->y());
> +    pp = node->convertToPage(pp);
> +    return WebKitPoint::create(pp.x(), pp.y());
> +}

Use pagePoint, or absolutePoint, not pp, for readability.


> +    FloatPoint pp(p->x(), p->y());
> +    pp = node->convertFromPage(pp);
> +    return WebKitPoint::create(pp.x(), pp.y());

localPoint, rather than pp.

> Index: WebCore/page/WebKitPoint.h
> ===================================================================
> --- WebCore/page/WebKitPoint.h	(revision 0)
> +++ WebCore/page/WebKitPoint.h	(revision 0)
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (C) 2007 Apple Inc.  All rights reserved.

2009

> +    private:
> +        WebKitPoint(float x=0, float y=0)

> +        : m_x(x)
> +        , m_y(y)

Indent these two lines


> Index: WebCore/page/WebKitPoint.idl
> ===================================================================

> + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.

2009

> +module window {
> +
> +    interface WebKitPoint {
> +        attribute float x;
> +        attribute float y;
> +    };

r=me with those fixes.
Comment 3 Simon Fraser (smfr) 2009-02-25 11:06:14 PST
<rdar://problem/6614343>
Comment 4 Chris Marrin 2009-02-25 11:10:24 PST
Sending        LayoutTests/ChangeLog
Adding         LayoutTests/fast/dom/Window/webkitConvertPoint-expected.txt
Adding         LayoutTests/fast/dom/Window/webkitConvertPoint.html
Sending        LayoutTests/fast/dom/Window/window-properties-expected.txt
Sending        LayoutTests/fast/js/global-constructors-expected.txt
Sending        WebCore/ChangeLog
Sending        WebCore/DerivedSources.make
Sending        WebCore/WebCore.pro
Sending        WebCore/WebCore.vcproj/WebCore.vcproj
Sending        WebCore/WebCore.xcodeproj/project.pbxproj
Sending        WebCore/WebCoreSources.bkl
Sending        WebCore/bindings/js/JSDOMWindowBase.cpp
Adding         WebCore/bindings/js/JSWebKitPointConstructor.cpp
Adding         WebCore/bindings/js/JSWebKitPointConstructor.h
Sending        WebCore/dom/Node.cpp
Sending        WebCore/dom/Node.h
Sending        WebCore/page/DOMWindow.cpp
Sending        WebCore/page/DOMWindow.h
Sending        WebCore/page/DOMWindow.idl
Adding         WebCore/page/WebKitPoint.h
Adding         WebCore/page/WebKitPoint.idl
Transmitting file data .....................
Committed revision 41218.

Comment 5 Chris Marrin 2009-02-25 11:56:39 PST
Windows build is broken

Comment 6 Chris Marrin 2009-02-25 14:00:04 PST
Windows build fIxed by http://build.webkit.org/changes/1678