[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:31:49 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f141671e3d1c7b443c686b65b29bafcfb421011d
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 17:20:13 2010 +0000

    Need WebKit2 API to get the cell above a table cell
    <rdar://problem/8537111>
    https://bugs.webkit.org/show_bug.cgi?id=47532
    
    Reviewed by Anders Carlsson.
    
    WebCore:
    
    Re-factor functionality to get the cell above a table cell
    into a function on HTMLTableCellElement and export it for use
    as SPI.
    
    * WebCore.exp.in:
    * WebCore.xcodeproj/project.pbxproj:
    * html/HTMLTableCellElement.cpp:
    (WebCore::HTMLTableCellElement::cellAbove): Move implementation here...
    * html/HTMLTableCellElement.h:
    * page/Frame.cpp:
    (WebCore::Frame::searchForLabelsAboveCell): ...from here.
    
    WebKit2:
    
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
    (WKBundleNodeHandleCopyHTMLTableCellElementCellAbove):
    * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
    (WebKit::InjectedBundleNodeHandle::copyHTMLTableCellElementCellAbove):
    * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69587 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e759126..ad14c7a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-12  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Need WebKit2 API to get the cell above a table cell
+        <rdar://problem/8537111>
+        https://bugs.webkit.org/show_bug.cgi?id=47532
+
+        Re-factor functionality to get the cell above a table cell
+        into a function on HTMLTableCellElement and export it for use
+        as SPI.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLTableCellElement.cpp:
+        (WebCore::HTMLTableCellElement::cellAbove): Move implementation here...
+        * html/HTMLTableCellElement.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::searchForLabelsAboveCell): ...from here.
+
 2010-10-12  Dave Moore  <davemoore at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index e0a6af1..9206522 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -980,6 +980,7 @@ __ZNK7WebCore19SelectionController17isInPasswordFieldEv
 __ZNK7WebCore19SelectionController18isFocusedAndActiveEv
 __ZNK7WebCore19SelectionController31getClippedVisibleTextRectanglesERN3WTF6VectorINS_9FloatRectELm0EEE
 __ZNK7WebCore19SelectionController6boundsEb
+__ZNK7WebCore20HTMLTableCellElement9cellAboveEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusCodeEv
 __ZNK7WebCore20ResourceResponseBase14httpStatusTextEv
 __ZNK7WebCore20ResourceResponseBase15httpHeaderFieldEPKc
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 94d3aca..fea9e0e 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -3366,9 +3366,9 @@
 		A871DB270A150BD600B12A68 /* HTMLTableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB190A150BD600B12A68 /* HTMLTableElement.h */; };
 		A871DB280A150BD600B12A68 /* HTMLTableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DB1A0A150BD600B12A68 /* HTMLTableElement.cpp */; };
 		A871DB290A150BD600B12A68 /* HTMLTableColElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DB1B0A150BD600B12A68 /* HTMLTableColElement.cpp */; };
-		A871DB2A0A150BD600B12A68 /* HTMLTableCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB1C0A150BD600B12A68 /* HTMLTableCellElement.h */; };
+		A871DB2A0A150BD600B12A68 /* HTMLTableCellElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB1C0A150BD600B12A68 /* HTMLTableCellElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A871DB2B0A150BD600B12A68 /* HTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB1D0A150BD600B12A68 /* HTMLTableCaptionElement.h */; };
-		A871DB2C0A150BD600B12A68 /* HTMLTablePartElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB1E0A150BD600B12A68 /* HTMLTablePartElement.h */; };
+		A871DB2C0A150BD600B12A68 /* HTMLTablePartElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB1E0A150BD600B12A68 /* HTMLTablePartElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A871DB2D0A150BD600B12A68 /* HTMLTablePartElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DB1F0A150BD600B12A68 /* HTMLTablePartElement.cpp */; };
 		A871DB2E0A150BD600B12A68 /* HTMLTableCellElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DB200A150BD600B12A68 /* HTMLTableCellElement.cpp */; };
 		A871DB2F0A150BD600B12A68 /* HTMLTableColElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DB210A150BD600B12A68 /* HTMLTableColElement.h */; };
diff --git a/WebCore/html/HTMLTableCellElement.cpp b/WebCore/html/HTMLTableCellElement.cpp
index 6568d23..f14a45b 100644
--- a/WebCore/html/HTMLTableCellElement.cpp
+++ b/WebCore/html/HTMLTableCellElement.cpp
@@ -165,4 +165,20 @@ void HTMLTableCellElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls)
     addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr)));
 }
 
+HTMLTableCellElement* HTMLTableCellElement::cellAbove() const
+{
+    RenderObject* cellRenderer = renderer();
+    if (!cellRenderer)
+        return 0;
+    if (!cellRenderer->isTableCell())
+        return 0;
+
+    RenderTableCell* tableCellRenderer = toRenderTableCell(cellRenderer);
+    RenderTableCell* cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
+    if (!cellAboveRenderer)
+        return 0;
+
+    return static_cast<HTMLTableCellElement*>(cellAboveRenderer->node());
 }
+
+} // namespace WebCore
diff --git a/WebCore/html/HTMLTableCellElement.h b/WebCore/html/HTMLTableCellElement.h
index 0c97413..f6d202b 100644
--- a/WebCore/html/HTMLTableCellElement.h
+++ b/WebCore/html/HTMLTableCellElement.h
@@ -53,6 +53,8 @@ public:
     void setRowSpan(int);
     String scope() const;
 
+    HTMLTableCellElement* cellAbove() const;
+
 private:
     HTMLTableCellElement(const QualifiedName&, Document*);
 
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 5a040f1..186d564 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -343,35 +343,25 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
 
 String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
 {
-    RenderObject* cellRenderer = cell->renderer();
-
-    if (cellRenderer && cellRenderer->isTableCell()) {
-        RenderTableCell* tableCellRenderer = toRenderTableCell(cellRenderer);
-        RenderTableCell* cellAboveRenderer = tableCellRenderer->table()->cellAbove(tableCellRenderer);
-
-        if (cellAboveRenderer) {
-            HTMLTableCellElement* aboveCell =
-                static_cast<HTMLTableCellElement*>(cellAboveRenderer->node());
-
-            if (aboveCell) {
-                // search within the above cell we found for a match
-                size_t lengthSearched = 0;    
-                for (Node* n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
-                    if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
-                        // For each text chunk, run the regexp
-                        String nodeString = n->nodeValue();
-                        int pos = regExp->searchRev(nodeString);
-                        if (pos >= 0) {
-                            if (resultDistanceFromStartOfCell)
-                                *resultDistanceFromStartOfCell = lengthSearched;
-                            return nodeString.substring(pos, regExp->matchedLength());
-                        }
-                        lengthSearched += nodeString.length();
-                    }
+    HTMLTableCellElement* aboveCell = cell->cellAbove();
+    if (aboveCell) {
+        // search within the above cell we found for a match
+        size_t lengthSearched = 0;    
+        for (Node* n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
+            if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
+                // For each text chunk, run the regexp
+                String nodeString = n->nodeValue();
+                int pos = regExp->searchRev(nodeString);
+                if (pos >= 0) {
+                    if (resultDistanceFromStartOfCell)
+                        *resultDistanceFromStartOfCell = lengthSearched;
+                    return nodeString.substring(pos, regExp->matchedLength());
                 }
+                lengthSearched += nodeString.length();
             }
         }
     }
+
     // Any reason in practice to search all cells in that are above cell?
     if (resultDistanceFromStartOfCell)
         *resultDistanceFromStartOfCell = notFound;
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1da5314..2c25f1f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-12  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Need WebKit2 API to get the cell above a table cell
+        <rdar://problem/8537111>
+        https://bugs.webkit.org/show_bug.cgi?id=47532
+
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
+        (WKBundleNodeHandleCopyHTMLTableCellElementCellAbove):
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::copyHTMLTableCellElementCellAbove):
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
+
 2010-10-11  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
index 7f7a110..9728e3a 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
@@ -52,3 +52,9 @@ void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlI
 {
     toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutofilled(filled);
 }
+
+WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandleRef)
+{
+    RefPtr<InjectedBundleNodeHandle> nodeHandle = toImpl(htmlTableCellElementHandleRef)->copyHTMLTableCellElementCellAbove();
+    return toAPI(nodeHandle.release().releaseRef());
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
index e35a83c..4a0b771 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
@@ -36,11 +36,16 @@ extern "C" {
 
 WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCreate(JSContextRef context, JSObjectRef object);
 
+
 /* Additional DOM Operations */
 
+/* HTMLInputElement Operations */
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
 
+/* HTMLTableCellElement Operations */
+WK_EXPORT WKBundleNodeHandleRef WKBundleNodeHandleCopyHTMLTableCellElementCellAbove(WKBundleNodeHandleRef htmlTableCellElementHandle);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
index 547ddf1..c0a71a0 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
@@ -27,6 +27,7 @@
 
 #include <JavaScriptCore/APICast.h>
 #include <WebCore/HTMLInputElement.h>
+#include <WebCore/HTMLTableCellElement.h>
 #include <WebCore/JSNode.h>
 #include <WebCore/Node.h>
 #include <WebCore/HTMLNames.h>
@@ -105,4 +106,12 @@ void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
     static_cast<HTMLInputElement*>(m_node.get())->setAutofilled(filled);
 }
 
+PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::copyHTMLTableCellElementCellAbove()
+{
+    if (!m_node->hasTagName(tdTag))
+        return 0;
+
+    return getOrCreate(static_cast<HTMLTableCellElement*>(m_node.get())->cellAbove());
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
index 94090e1..38c901f 100644
--- a/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
+++ b/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
@@ -52,6 +52,7 @@ public:
     // Note: These should only be operations that are not exposed to JavaScript.
     void setHTMLInputElementValueForUser(const String&);
     void setHTMLInputElementAutofilled(bool);
+    PassRefPtr<InjectedBundleNodeHandle> copyHTMLTableCellElementCellAbove();
 
 private:
     static PassRefPtr<InjectedBundleNodeHandle> create(WebCore::Node*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list