[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 14:54:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fc1f704eb02fcab50a64e951e51f89a55483faa1
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 25 01:10:22 2010 +0000

    Need a way to determine the screen rect for a form control in WebKit2
    <rdar://problem/8530670>
    https://bugs.webkit.org/show_bug.cgi?id=48216
    
    Reviewed by Dan Bernstein.
    
    WebCore:
    
    * WebCore.exp.in: Add export.
    * dom/Element.cpp:
    (WebCore::Element::boundsInWindowSpace):
    * dom/Element.h:
    Add function to return the bounding box in window (in ScrollView terminology) space,
    this is the same space as the root viewport.
    
    WebKit2:
    
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toAPI):
    Add conversion from IntRect to WKRect.
    
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
    (WKBundleNodeHandleGetElementBounds):
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
    (WebKit::InjectedBundleNodeHandle::elementBounds):
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
    Add SPI to get the rect in window space. The client can then convert this to screen
    space if they wish to.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70428 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 25542a0..3d80d80 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-24  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Need a way to determine the screen rect for a form control in WebKit2
+        <rdar://problem/8530670>
+        https://bugs.webkit.org/show_bug.cgi?id=48216
+
+        * WebCore.exp.in: Add export.
+        * dom/Element.cpp:
+        (WebCore::Element::boundsInWindowSpace):
+        * dom/Element.h:
+        Add function to return the bounding box in window (in ScrollView terminology) space,
+        this is the same space as the root viewport.
+
 2010-10-24  Andreas Kling  <kling at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 233de29..299c012 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -347,21 +347,17 @@ __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
 __ZN7WebCore15FocusController9setActiveEb
 __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE
+__ZN7WebCore15GraphicsContext15setFillGradientEN3WTF10PassRefPtrINS_8GradientEEE
 __ZN7WebCore15GraphicsContext20endTransparencyLayerEv
 __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE
 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
+__ZN7WebCore15GraphicsContext4clipERKNS_4PathE
 __ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
+__ZN7WebCore15GraphicsContext4saveEv
 __ZN7WebCore15GraphicsContext5scaleERKNS_9FloatSizeE
-__ZN7WebCore15GraphicsContext15setFillGradientEN3WTF10PassRefPtrINS_8GradientEEE
-__ZN7WebCore4PathD1Ev
-__ZN7WebCore8Gradient12addColorStopEfRKNS_5ColorE
-__ZN7WebCore4PathC1Ev
-__ZN7WebCore15GraphicsContext4clipERKNS_4PathE
-__ZN7WebCore15GraphicsContext8fillPathEv
-__ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeE
 __ZN7WebCore15GraphicsContext7addPathERKNS_4PathE
-__ZN7WebCore15GraphicsContext4saveEv
 __ZN7WebCore15GraphicsContext7restoreEv
+__ZN7WebCore15GraphicsContext8fillPathEv
 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectE
 __ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext9setShadowERKNS_9FloatSizeEfRKNS_5ColorENS_10ColorSpaceE
@@ -485,8 +481,8 @@ __ZN7WebCore22counterValueForElementEPNS_7ElementE
 __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKN3WTF6StringE
 __ZN7WebCore22externalRepresentationEPNS_5FrameEj
 __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE
-__ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE
 __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE
+__ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE
 __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv
 __ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore24DocumentMarkerController14markersForNodeEPNS_4NodeE
@@ -607,6 +603,9 @@ __ZN7WebCore4Page9goForwardEv
 __ZN7WebCore4Page9initGroupEv
 __ZN7WebCore4PageC1ERKNS0_11PageClientsE
 __ZN7WebCore4PageD1Ev
+__ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeE
+__ZN7WebCore4PathC1Ev
+__ZN7WebCore4PathD1Ev
 __ZN7WebCore4coreEP20NSURLProtectionSpace
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE
@@ -721,6 +720,7 @@ __ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
 __ZN7WebCore8Document4headEv
 __ZN7WebCore8FormData6createEPKvm
 __ZN7WebCore8FormDataD1Ev
+__ZN7WebCore8Gradient12addColorStopEfRKNS_5ColorE
 __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_
 __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEi
@@ -901,8 +901,8 @@ __ZNK7WebCore11FrameLoader12blockedErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE
 __ZNK7WebCore11FrameLoader14frameHasLoadedEv
 __ZNK7WebCore11FrameLoader16outgoingReferrerEv
-__ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
 __ZNK7WebCore11FrameLoader17networkingContextEv
+__ZNK7WebCore11FrameLoader20activeDocumentLoaderEv
 __ZNK7WebCore11FrameLoader27numPendingOrLoadingRequestsEb
 __ZNK7WebCore11FrameLoader8loadTypeEv
 __ZNK7WebCore11HistoryItem10visitCountEv
@@ -1085,6 +1085,7 @@ __ZNK7WebCore6Widget25convertToContainingWindowERKNS_7IntRectE
 __ZNK7WebCore6Widget25convertToContainingWindowERKNS_8IntPointE
 __ZNK7WebCore6Widget9frameRectEv
 __ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
+__ZNK7WebCore7Element19boundsInWindowSpaceEv
 __ZNK7WebCore7Element9innerTextEv
 __ZNK7WebCore7IntRectcv6CGRectEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index da7bf38..f3d388e 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -457,6 +457,41 @@ int Element::scrollHeight() const
     return 0;
 }
 
+IntRect Element::boundsInWindowSpace() const
+{
+    document()->updateLayoutIgnorePendingStylesheets();
+
+    FrameView* view = document()->view();
+    if (!view)
+        return IntRect();
+
+    Vector<FloatQuad> quads;
+#if ENABLE(SVG)
+    if (isSVGElement() && renderer()) {
+        // Get the bounding rectangle from the SVG model.
+        const SVGElement* svgElement = static_cast<const SVGElement*>(this);
+        FloatRect localRect;
+        if (svgElement->boundingBox(localRect))
+            quads.append(renderer()->localToAbsoluteQuad(localRect));
+    } else
+#endif
+    {
+        // Get the bounding rectangle from the box model.
+        if (renderBoxModelObject())
+            renderBoxModelObject()->absoluteQuads(quads);
+    }
+
+    if (quads.isEmpty())
+        return IntRect();
+
+    IntRect result = quads[0].enclosingBoundingBox();
+    for (size_t i = 1; i < quads.size(); ++i)
+        result.unite(quads[i].enclosingBoundingBox());
+
+    result = view->contentsToWindow(result);
+    return result;
+}
+
 PassRefPtr<ClientRectList> Element::getClientRects() const
 {
     document()->updateLayoutIgnorePendingStylesheets();
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index b890ecd..f5f170a 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -159,6 +159,8 @@ public:
     virtual int scrollWidth() const;
     virtual int scrollHeight() const;
 
+    IntRect boundsInWindowSpace() const;
+
     PassRefPtr<ClientRectList> getClientRects() const;
     PassRefPtr<ClientRect> getBoundingClientRect() const;
 
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 16fd01d..91bd82d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
+2010-10-24  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Dan Bernstein.
+
+        Need a way to determine the screen rect for a form control in WebKit2
+        <rdar://problem/8530670>
+        https://bugs.webkit.org/show_bug.cgi?id=48216
+
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toAPI):
+        Add conversion from IntRect to WKRect.
+
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
+        (WKBundleNodeHandleGetElementBounds):
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::elementBounds):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
+        Add SPI to get the rect in window space. The client can then convert this to screen
+        space if they wish to.
+
 2010-10-23  Xan Lopez  <xlopez at igalia.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/API/c/WKSharedAPICast.h b/WebKit2/Shared/API/c/WKSharedAPICast.h
index bfb46e9..fbae30b 100644
--- a/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/WebKit2/Shared/API/c/WKSharedAPICast.h
@@ -174,6 +174,16 @@ inline WKRect toAPI(const WebCore::FloatRect& rect)
     return wkRect;
 }
 
+inline WKRect toAPI(const WebCore::IntRect& rect)
+{
+    WKRect wkRect;
+    wkRect.origin.x = rect.x();
+    wkRect.origin.y = rect.y();
+    wkRect.size.width = rect.width();
+    wkRect.size.height = rect.height();
+    return wkRect;
+}
+
 /* Enum conversions */
 
 inline WKTypeID toAPI(APIObject::Type type)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
index 9728e3a..5f98cd0 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
@@ -43,6 +43,11 @@ WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef contextRef, JSObject
     return toAPI(nodeHandle.release().releaseRef());
 }
 
+WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandleRef)
+{
+    return toAPI(toImpl(nodeHandleRef)->elementBounds());
+}
+
 void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandleRef, WKStringRef valueRef)
 {
     toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef));
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
index 4a0b771..376d931 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
@@ -39,11 +39,13 @@ WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef context, J
 
 /* Additional DOM Operations */
 
-/* HTMLInputElement Operations */
+WK_EXPORT WKRect WKBundleNodeHandleGetElementBounds(WKBundleNodeHandleRef nodeHandle);
+
+/* HTMLInputElement Specific Operations */
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
 
-/* HTMLTableCellElement Operations */
+/* HTMLTableCellElement Specific Operations */
 WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandle);
 
 #ifdef __cplusplus
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
index c0a71a0..572fd80 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
@@ -27,10 +27,11 @@
 
 #include <JavaScriptCore/APICast.h>
 #include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLNames.h>
 #include <WebCore/HTMLTableCellElement.h>
+#include <WebCore/IntRect.h>
 #include <WebCore/JSNode.h>
 #include <WebCore/Node.h>
-#include <WebCore/HTMLNames.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/WTFString.h>
 
@@ -90,6 +91,14 @@ Node* InjectedBundleNodeHandle::coreNode() const
 // Additional DOM Operations
 // Note: These should only be operations that are not exposed to JavaScript.
 
+IntRect InjectedBundleNodeHandle::elementBounds() const
+{
+    if (!m_node->isElementNode())
+        return IntRect();
+
+    return static_cast<Element*>(m_node.get())->boundsInWindowSpace();
+}
+
 void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
 {
     if (!m_node->hasTagName(inputTag))
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
index 38c901f..82b75e1 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
@@ -30,6 +30,7 @@
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
+    class IntRect;
     class Node;
 }
 
@@ -50,6 +51,7 @@ public:
 
     // Additional DOM Operations
     // Note: These should only be operations that are not exposed to JavaScript.
+    WebCore::IntRect elementBounds() const;
     void setHTMLInputElementValueForUser(const String&);
     void setHTMLInputElementAutofilled(bool);
     PassRefPtr<InjectedBundleNodeHandle> copyHTMLTableCellElementCellAbove();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list