[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

sullivan at apple.com sullivan at apple.com
Thu Apr 8 01:15:29 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d4a9d660d0d43342e29bfb619d4439b2272df884
Author: sullivan at apple.com <sullivan at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 19 23:22:12 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=33854
    Would like a variant of WebHTMLRepresentation's searchForLabelsBeforeElement that returns
    more info about where the result was found
    
    WebCore:
    
    Reviewed by Darin Adler.
    
    No new tests. This just adds a couple of out parameters for the benefit of WebKit clients.
    
    * WebCore.base.exp:
    Updated mangled signature for export.
    
    * page/Frame.cpp:
    (WebCore::Frame::searchForLabelsAboveCell):
    Now fills in an out parameter with the number of characters from the start of the cell.
    (WebCore::Frame::searchForLabelsBeforeElement):
    Now fills in an out parameter with the distance as a number of characters, and another
    with a bool for whether the result was in a table cell above the current cell (otherwise
    it was found in the text before this element and after the previous element or start of form).
    
    * page/Frame.h:
    Updated signatures.
    
    * page/mac/FrameMac.mm:
    (WebCore::Frame::searchForNSLabelsAboveCell):
    Same as above. This is a parallel copy of the function using Mac-specific data structures.
    (WebCore::Frame::searchForLabelsBeforeElement):
    Ditto
    
    WebKit/mac:
    
    Reviewed by Darin Adler
    
    * WebView/WebHTMLRepresentation.h:
    Declare -searchForLabels:beforeElement:resultDistance:resultIsInCellAbove.
    
    * WebView/WebHTMLRepresentation.mm:
    (-[WebHTMLRepresentation searchForLabels:beforeElement:]):
    Now calls through to searchForLabels:beforeElement:resultDistance:resultIsInCellAbove.
    (-[WebHTMLRepresentation searchForLabels:beforeElement:resultDistance:resultIsInCellAbove:]):
    New method, calls through to WebCore.
    
    WebKit/win:
    
    Reviewed by Darin Adler
    
    * Interfaces/IWebHTMLRepresentation.idl:
    Created variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
    
    * Interfaces/WebKit.idl:
    Touched in order to get other idl change to propagate correctly.
    
    * WebHTMLRepresentation.cpp:
    (WebHTMLRepresentation::deprecatedSearchForLabels):
    Renamed since iDL doesn't support two functions with the same name but different signatures.
    (WebHTMLRepresentation::searchForLabels):
    Implemented variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
    
    * WebHTMLRepresentation.h:
    Declared variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53500 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ef7293a..8f752e6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-01-19  John Sullivan  <sullivan at apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=33854
+        Would like a variant of WebHTMLRepresentation's searchForLabelsBeforeElement that returns 
+        more info about where the result was found
+
+        Reviewed by Darin Adler.
+
+        No new tests. This just adds a couple of out parameters for the benefit of WebKit clients.
+
+        * WebCore.base.exp:
+        Updated mangled signature for export.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::searchForLabelsAboveCell):
+        Now fills in an out parameter with the number of characters from the start of the cell.
+        (WebCore::Frame::searchForLabelsBeforeElement):
+        Now fills in an out parameter with the distance as a number of characters, and another
+        with a bool for whether the result was in a table cell above the current cell (otherwise
+        it was found in the text before this element and after the previous element or start of form).
+
+        * page/Frame.h:
+        Updated signatures.
+
+        * page/mac/FrameMac.mm:
+        (WebCore::Frame::searchForNSLabelsAboveCell):
+        Same as above. This is a parallel copy of the function using Mac-specific data structures.
+        (WebCore::Frame::searchForLabelsBeforeElement):
+        Ditto
+
 2010-01-19  Jakob Petsovits  <jpetsovits at rim.com>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 3311c48..de59265 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -520,7 +520,7 @@ __ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
 __ZN7WebCore5Frame24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore5Frame24setExcludeFromTextSearchEb
 __ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE
-__ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementE
+__ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementEPmPb
 __ZN7WebCore5Frame34setMarkedTextMatchesAreHighlightedEb
 __ZN7WebCore5Frame4initEv
 __ZN7WebCore5Frame6scriptEv
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 58531fb..e2f421b 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -415,7 +415,7 @@ static RegularExpression* createRegExpForLabels(const Vector<String>& labels)
     return new RegularExpression(pattern, TextCaseInsensitive);
 }
 
-String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
+String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
 {
     RenderObject* cellRenderer = cell->renderer();
 
@@ -429,23 +429,30 @@ String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellE
 
             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 (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;
     return String();
 }
 
-String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element)
+String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element, size_t* resultDistance, bool* resultIsInCellAbove)
 {
     OwnPtr<RegularExpression> regExp(createRegExpForLabels(labels));
     // We stop searching after we've seen this many chars
@@ -457,6 +464,11 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
     HTMLTableCellElement* startingTableCell = 0;
     bool searchedCellAbove = false;
 
+    if (resultDistance)
+        *resultDistance = notFound;
+    if (resultIsInCellAbove)
+        *resultIsInCellAbove = false;
+    
     // walk backwards in the node tree, until another element, or form, or end of tree
     int unsigned lengthSearched = 0;
     Node* n;
@@ -472,9 +484,12 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
         } else if (n->hasTagName(tdTag) && !startingTableCell) {
             startingTableCell = static_cast<HTMLTableCellElement*>(n);
         } else if (n->hasTagName(trTag) && startingTableCell) {
-            String result = searchForLabelsAboveCell(regExp.get(), startingTableCell);
-            if (!result.isEmpty())
+            String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance);
+            if (!result.isEmpty()) {
+                if (resultIsInCellAbove)
+                    *resultIsInCellAbove = true;
                 return result;
+            }
             searchedCellAbove = true;
         } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
             // For each text chunk, run the regexp
@@ -483,16 +498,25 @@ String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element
             if (lengthSearched + nodeString.length() > maxCharsSearched)
                 nodeString = nodeString.right(charsSearchedThreshold - lengthSearched);
             int pos = regExp->searchRev(nodeString);
-            if (pos >= 0)
+            if (pos >= 0) {
+                if (resultDistance)
+                    *resultDistance = lengthSearched;
                 return nodeString.substring(pos, regExp->matchedLength());
+            }
             lengthSearched += nodeString.length();
         }
     }
 
     // If we started in a cell, but bailed because we found the start of the form or the
     // previous element, we still might need to search the row above us for a label.
-    if (startingTableCell && !searchedCellAbove)
-         return searchForLabelsAboveCell(regExp.get(), startingTableCell);
+    if (startingTableCell && !searchedCellAbove) {
+         String result = searchForLabelsAboveCell(regExp.get(), startingTableCell, resultDistance);
+        if (!result.isEmpty()) {
+            if (resultIsInCellAbove)
+                *resultIsInCellAbove = true;
+            return result;
+        }
+    }
     return String();
 }
 
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index 6940fc8..33bb435 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -260,8 +260,8 @@ namespace WebCore {
 
         SelectionController* dragCaretController() const;
 
-        String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
-        String searchForLabelsBeforeElement(const Vector<String>& labels, Element*);
+        String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
+        String searchForLabelsBeforeElement(const Vector<String>& labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);
         String matchLabelsAgainstElement(const Vector<String>& labels, Element*);
 
         VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
@@ -272,8 +272,8 @@ namespace WebCore {
     // === undecided, would like to consider moving to another class
 
     public:
-        NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
-        NSString* searchForLabelsBeforeElement(NSArray* labels, Element*);
+        NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
+        NSString* searchForLabelsBeforeElement(NSArray* labels, Element*, size_t* resultDistance, bool* resultIsInCellAbove);
         NSString* matchLabelsAgainstElement(NSArray* labels, Element*);
 
     #if ENABLE(DASHBOARD_SUPPORT)
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm
index fbaf895..9e77387 100644
--- a/WebCore/page/mac/FrameMac.mm
+++ b/WebCore/page/mac/FrameMac.mm
@@ -143,7 +143,7 @@ static RegularExpression* regExpForLabels(NSArray* labels)
     return result;
 }
 
-NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
+NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell, size_t* resultDistanceFromStartOfCell)
 {
     RenderObject* cellRenderer = cell->renderer();
 
@@ -157,23 +157,30 @@ NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTable
 
             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 (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;
     return nil;
 }
 
-NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
+NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element, size_t* resultDistance, bool* resultIsInCellAbove)
 {
     RegularExpression* regExp = regExpForLabels(labels);
     // We stop searching after we've seen this many chars
@@ -184,6 +191,11 @@ NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
     // If the starting element is within a table, the cell that contains it
     HTMLTableCellElement* startingTableCell = 0;
     bool searchedCellAbove = false;
+    
+    if (resultDistance)
+        *resultDistance = notFound;
+    if (resultIsInCellAbove)
+        *resultIsInCellAbove = false;
 
     // walk backwards in the node tree, until another element, or form, or end of tree
     int unsigned lengthSearched = 0;
@@ -200,9 +212,12 @@ NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
         } else if (n->hasTagName(tdTag) && !startingTableCell) {
             startingTableCell = static_cast<HTMLTableCellElement*>(n);
         } else if (n->hasTagName(trTag) && startingTableCell) {
-            NSString* result = searchForLabelsAboveCell(regExp, startingTableCell);
-            if (result && [result length] > 0)
+            NSString* result = searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
+            if (result && [result length] > 0) {
+                if (resultIsInCellAbove)
+                    *resultIsInCellAbove = true;
                 return result;
+            }
             searchedCellAbove = true;
         } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
             // For each text chunk, run the regexp
@@ -211,9 +226,11 @@ NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
             if (lengthSearched + nodeString.length() > maxCharsSearched)
                 nodeString = nodeString.right(charsSearchedThreshold - lengthSearched);
             int pos = regExp->searchRev(nodeString);
-            if (pos >= 0)
+            if (pos >= 0) {
+                if (resultDistance)
+                    *resultDistance = lengthSearched;
                 return nodeString.substring(pos, regExp->matchedLength());
-
+            }
             lengthSearched += nodeString.length();
         }
     }
@@ -221,9 +238,12 @@ NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
     // If we started in a cell, but bailed because we found the start of the form or the
     // previous element, we still might need to search the row above us for a label.
     if (startingTableCell && !searchedCellAbove) {
-        NSString* result = searchForLabelsAboveCell(regExp, startingTableCell);
-        if (result && [result length] > 0)
+        NSString* result = searchForLabelsAboveCell(regExp, startingTableCell, resultDistance);
+        if (result && [result length] > 0) {
+            if (resultIsInCellAbove)
+                *resultIsInCellAbove = true;
             return result;
+        }
     }
     
     return nil;
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 65bc486..66fe9c0 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-19  John Sullivan  <sullivan at apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=33854
+        Would like a variant of WebHTMLRepresentation's searchForLabelsBeforeElement that returns 
+        more info about where the result was found
+
+        Reviewed by Darin Adler
+
+        * WebView/WebHTMLRepresentation.h:
+        Declare -searchForLabels:beforeElement:resultDistance:resultIsInCellAbove.
+        
+        * WebView/WebHTMLRepresentation.mm:
+        (-[WebHTMLRepresentation searchForLabels:beforeElement:]):
+        Now calls through to searchForLabels:beforeElement:resultDistance:resultIsInCellAbove.
+        (-[WebHTMLRepresentation searchForLabels:beforeElement:resultDistance:resultIsInCellAbove:]):
+        New method, calls through to WebCore.
+
 2010-01-19  Dave Hyatt  <hyatt at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.h b/WebKit/mac/WebView/WebHTMLRepresentation.h
index 2098c47..7814968 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.h
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.h
@@ -60,7 +60,11 @@
 - (DOMElement *)formForElement:(DOMElement *)element;
 - (DOMElement *)currentForm;
 - (NSArray *)controlsInForm:(DOMElement *)form;
-- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element resultDistance:(NSUInteger*)outDistance resultIsInCellAbove:(BOOL*)outIsInCellAbove;
 - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
 
+// Deprecated SPI
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element; // Use -searchForLabels:beforeElement:resultDistance:resultIsInCellAbove:
+
+
 @end
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm
index 39489e8..4b462bb 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.mm
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm
@@ -337,7 +337,27 @@ static HTMLInputElement* inputElementFromDOMElement(DOMElement* element)
 
 - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element
 {
-    return core([_private->dataSource webFrame])->searchForLabelsBeforeElement(labels, core(element));
+    return [self searchForLabels:labels beforeElement:element resultDistance:0 resultIsInCellAbove:0];
+}
+
+- (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element resultDistance:(NSUInteger*)outDistance resultIsInCellAbove:(BOOL*)outIsInCellAbove
+{
+    size_t distance;
+    bool isInCellAbove;
+    
+    NSString *result = core([_private->dataSource webFrame])->searchForLabelsBeforeElement(labels, core(element), &distance, &isInCellAbove);
+    
+    if (outDistance) {
+        if (distance == notFound)
+            *outDistance = NSNotFound;
+        else
+            *outDistance = distance;
+    }
+
+    if (outIsInCellAbove)
+        *outIsInCellAbove = isInCellAbove;
+    
+    return result;
 }
 
 - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 362be39..1d251f3 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,26 @@
+2010-01-19  John Sullivan  <sullivan at apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=33854
+        Would like a variant of WebHTMLRepresentation's searchForLabelsBeforeElement that returns 
+        more info about where the result was found
+
+        Reviewed by Darin Adler
+
+        * Interfaces/IWebHTMLRepresentation.idl:
+        Created variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
+        
+        * Interfaces/WebKit.idl:
+        Touched in order to get other idl change to propagate correctly.
+
+        * WebHTMLRepresentation.cpp:
+        (WebHTMLRepresentation::deprecatedSearchForLabels):
+        Renamed since iDL doesn't support two functions with the same name but different signatures.
+        (WebHTMLRepresentation::searchForLabels):
+        Implemented variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
+
+        * WebHTMLRepresentation.h:
+        Declared variant of searchForLabels that includes additional in/out parameters resultDistance and resultIsInCellAbove.
+
 2010-01-19  Adam Roben  <aroben at apple.com>
 
         Windows build fix
diff --git a/WebKit/win/Interfaces/IWebHTMLRepresentation.idl b/WebKit/win/Interfaces/IWebHTMLRepresentation.idl
index 7fbd451..ff39c0a 100644
--- a/WebKit/win/Interfaces/IWebHTMLRepresentation.idl
+++ b/WebKit/win/Interfaces/IWebHTMLRepresentation.idl
@@ -95,11 +95,17 @@ interface IWebHTMLRepresentation : IUnknown
 
     /*
         - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element;
+        Deprecated: use the variant that includes resultDistance and resultIsInCellAbove instead.
     */
-    HRESULT searchForLabels([in, size_is(cLabels)] BSTR* labels, [in] int cLabels, [in] IDOMElement* beforeElement, [out, retval] BSTR* result);
+    HRESULT deprecatedSearchForLabels([in, size_is(cLabels)] BSTR* labels, [in] int cLabels, [in] IDOMElement* beforeElement, [out, retval] BSTR* result);
 
     /*
         - (NSString *)matchLabels:(NSArray *)labels againstElement:(DOMElement *)element;
     */
     HRESULT matchLabels([in, size_is(cLabels)] BSTR* labels, [in] int cLabels, [in] IDOMElement* againstElement, [out, retval] BSTR* result);
+
+    /*
+        - (NSString *)searchForLabels:(NSArray *)labels beforeElement:(DOMElement *)element resultDistance:(NSUInteger*)outDistance resultIsInCellAbove:(BOOL*)outIsInCellAbove;
+    */
+    HRESULT searchForLabels([in, size_is(cLabels)] BSTR* labels, [in] unsigned cLabels, [in] IDOMElement* beforeElement, [out] unsigned* resultDistance, [out] BOOL* resultIsInCellAbove, [out, retval] BSTR* result);
 }
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 675c349..5ae1ad9 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -293,4 +293,3 @@ library WebKit
         [default] interface IWebGeolocationPosition;
     }
 }
-
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 86041cc..c0c1601 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -1278,13 +1278,17 @@ HRESULT WebFrame::elementIsPassword(IDOMElement *element, bool *result)
     return S_OK;
 }
 
-HRESULT WebFrame::searchForLabelsBeforeElement(const BSTR* labels, int cLabels, IDOMElement* beforeElement, BSTR* result)
+HRESULT WebFrame::searchForLabelsBeforeElement(const BSTR* labels, unsigned cLabels, IDOMElement* beforeElement, unsigned* outResultDistance, BOOL* outResultIsInCellAbove, BSTR* result)
 {
     if (!result) {
         ASSERT_NOT_REACHED();
         return E_POINTER;
     }
 
+    if (outResultDistance)
+        *outResultDistance = 0;
+    if (outResultIsInCellAbove)
+        *outResultIsInCellAbove = FALSE;
     *result = 0;
 
     if (!cLabels)
@@ -1303,11 +1307,18 @@ HRESULT WebFrame::searchForLabelsBeforeElement(const BSTR* labels, int cLabels,
     if (!coreElement)
         return E_FAIL;
 
-    String label = coreFrame->searchForLabelsBeforeElement(labelStrings, coreElement);
+    size_t resultDistance;
+    bool resultIsInCellAbove;
+    String label = coreFrame->searchForLabelsBeforeElement(labelStrings, coreElement, &resultDistance, &resultIsInCellAbove);
     
     *result = SysAllocStringLen(label.characters(), label.length());
     if (label.length() && !*result)
         return E_OUTOFMEMORY;
+    if (outResultDistance)
+        *outResultDistance = resultDistance;
+    if (outResultIsInCellAbove)
+        *outResultIsInCellAbove = resultIsInCellAbove;
+
     return S_OK;
 }
 
diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h
index 91b8e14..1a92751 100644
--- a/WebKit/win/WebFrame.h
+++ b/WebKit/win/WebFrame.h
@@ -336,7 +336,7 @@ public:
     HRESULT formForElement(IDOMElement* element, IDOMElement** form);
     HRESULT controlsInForm(IDOMElement* form, IDOMElement** controls, int* cControls);
     HRESULT elementIsPassword(IDOMElement* element, bool* result);
-    HRESULT searchForLabelsBeforeElement(const BSTR* labels, int cLabels, IDOMElement* beforeElement, BSTR* result);
+    HRESULT searchForLabelsBeforeElement(const BSTR* labels, unsigned cLabels, IDOMElement* beforeElement, unsigned* resultDistance, BOOL* resultIsInCellAbove, BSTR* result);
     HRESULT matchLabelsAgainstElement(const BSTR* labels, int cLabels, IDOMElement* againstElement, BSTR* result);
     HRESULT canProvideDocumentSource(bool* result);
 
diff --git a/WebKit/win/WebHTMLRepresentation.cpp b/WebKit/win/WebHTMLRepresentation.cpp
index 16e4dc6..dd5813d 100644
--- a/WebKit/win/WebHTMLRepresentation.cpp
+++ b/WebKit/win/WebHTMLRepresentation.cpp
@@ -103,7 +103,7 @@ ULONG STDMETHODCALLTYPE WebHTMLRepresentation::Release()
 
 // IWebHTMLRepresentation --------------------------------------------------------------------
 
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedMIMETypes( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedMIMETypes(
         /* [out][in] */ BSTR* /*types*/,
         /* [out][in] */ int* /*cTypes*/)
 {
@@ -111,7 +111,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedMIMETypes(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedNonImageMIMETypes( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedNonImageMIMETypes(
         /* [out][in] */ BSTR* /*types*/,
         /* [out][in] */ int* /*cTypes*/)
 {
@@ -119,7 +119,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedNonImageMIMETypes(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedImageMIMETypes( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedImageMIMETypes(
         /* [out][in] */ BSTR* /*types*/,
         /* [out][in] */ int* /*cTypes*/)
 {
@@ -127,7 +127,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedImageMIMETypes(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::attributedStringFromDOMNodes( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::attributedStringFromDOMNodes(
         /* [in] */ IDOMNode* /*startNode*/,
         /* [in] */ int /*startOffset*/,
         /* [in] */ IDOMNode* /*endNode*/,
@@ -138,7 +138,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::attributedStringFromDOMNodes(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementWithName( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementWithName(
         /* [in] */ BSTR name,
         /* [in] */ IDOMElement* form,
         /* [retval][out] */ IDOMElement** element)
@@ -149,7 +149,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementWithName(
     return m_frame->elementWithName(name, form, element);
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementDoesAutoComplete( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementDoesAutoComplete(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ BOOL* result)
 {
@@ -159,7 +159,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementDoesAutoComplete(
     return hr;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementIsPassword( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementIsPassword(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ BOOL* result)
 {
@@ -169,7 +169,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementIsPassword(
     return hr;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::formForElement( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::formForElement(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ IDOMElement** form)
 {
@@ -179,7 +179,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::formForElement(
     return m_frame->formForElement(element, form);
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::currentForm( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::currentForm(
         /* [retval][out] */ IDOMElement** form)
 {
     if (!m_frame)
@@ -188,7 +188,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::currentForm(
     return m_frame->currentForm(form);
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::controlsInForm( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::controlsInForm(
         /* [in] */ IDOMElement* form,
         /* [out][in] */ IDOMElement** controls,
         /* [out][in] */ int* cControls)
@@ -196,16 +196,16 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::controlsInForm(
     return m_frame->controlsInForm(form, controls, cControls);
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::searchForLabels( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::deprecatedSearchForLabels(
         /* [size_is][in] */ BSTR* labels,
         /* [in] */ int cLabels,
         /* [in] */ IDOMElement* beforeElement,
         /* [retval][out] */ BSTR* result)
 {
-    return m_frame->searchForLabelsBeforeElement(labels, cLabels, beforeElement, result);
+    return m_frame->searchForLabelsBeforeElement(labels, cLabels, beforeElement, 0, 0, result);
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::matchLabels( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::matchLabels(
         /* [size_is][in] */ BSTR* labels,
         /* [in] */ int cLabels,
         /* [in] */ IDOMElement* againstElement,
@@ -214,16 +214,21 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::matchLabels(
     return m_frame->matchLabelsAgainstElement(labels, cLabels, againstElement, result);
 }
 
+HRESULT WebHTMLRepresentation::searchForLabels(BSTR* labels, unsigned cLabels, IDOMElement* beforeElement, unsigned* resultDistance, BOOL* resultIsInCellAbove, BSTR* result)
+{
+    return m_frame->searchForLabelsBeforeElement(labels, cLabels, beforeElement, resultDistance, resultIsInCellAbove, result);
+}
+
 // IWebDocumentRepresentation ----------------------------------------------------------------
 
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::setDataSource( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::setDataSource(
         /* [in] */ IWebDataSource* /*dataSource*/)
 {
     ASSERT_NOT_REACHED();
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedData( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedData(
         /* [in] */ IStream* /*data*/,
         /* [in] */ IWebDataSource* /*dataSource*/)
 {
@@ -231,7 +236,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedData(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedError( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedError(
         /* [in] */ IWebError* /*error*/,
         /* [in] */ IWebDataSource* /*dataSource*/)
 {
@@ -239,14 +244,14 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedError(
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::finishedLoadingWithDataSource( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::finishedLoadingWithDataSource(
         /* [in] */ IWebDataSource* /*dataSource*/)
 {
     ASSERT_NOT_REACHED();
     return E_NOTIMPL;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::canProvideDocumentSource( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::canProvideDocumentSource(
         /* [retval][out] */ BOOL* result)
 {
     bool canProvideSource;
@@ -255,7 +260,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::canProvideDocumentSource(
     return hr;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::documentSource( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::documentSource(
         /* [retval][out] */ BSTR* source)
 {
     if (!source)
@@ -306,7 +311,7 @@ HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::documentSource(
     return S_OK;
 }
     
-HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::title( 
+HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::title(
         /* [retval][out] */ BSTR* /*docTitle*/)
 {
     ASSERT_NOT_REACHED();
diff --git a/WebKit/win/WebHTMLRepresentation.h b/WebKit/win/WebHTMLRepresentation.h
index 01b8988..4d5eade 100644
--- a/WebKit/win/WebHTMLRepresentation.h
+++ b/WebKit/win/WebHTMLRepresentation.h
@@ -45,84 +45,87 @@ public:
     virtual ULONG STDMETHODCALLTYPE Release();
 
     // IWebHTMLRepresentation
-    virtual HRESULT STDMETHODCALLTYPE supportedMIMETypes( 
+    virtual HRESULT STDMETHODCALLTYPE supportedMIMETypes(
         /* [out][in] */ BSTR* types,
         /* [out][in] */ int* cTypes);
     
-    virtual HRESULT STDMETHODCALLTYPE supportedNonImageMIMETypes( 
+    virtual HRESULT STDMETHODCALLTYPE supportedNonImageMIMETypes(
         /* [out][in] */ BSTR* types,
         /* [out][in] */ int* cTypes);
     
-    virtual HRESULT STDMETHODCALLTYPE supportedImageMIMETypes( 
+    virtual HRESULT STDMETHODCALLTYPE supportedImageMIMETypes(
         /* [out][in] */ BSTR* types,
         /* [out][in] */ int* cTypes);
     
-    virtual HRESULT STDMETHODCALLTYPE attributedStringFromDOMNodes( 
+    virtual HRESULT STDMETHODCALLTYPE attributedStringFromDOMNodes(
         /* [in] */ IDOMNode* startNode,
         /* [in] */ int startOffset,
         /* [in] */ IDOMNode* endNode,
         /* [in] */ int endOffset,
         /* [retval][out] */ IDataObject** attributedString);
     
-    virtual HRESULT STDMETHODCALLTYPE elementWithName( 
+    virtual HRESULT STDMETHODCALLTYPE elementWithName(
         /* [in] */ BSTR name,
         /* [in] */ IDOMElement* form,
         /* [retval][out] */ IDOMElement** element);
     
-    virtual HRESULT STDMETHODCALLTYPE elementDoesAutoComplete( 
+    virtual HRESULT STDMETHODCALLTYPE elementDoesAutoComplete(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ BOOL* result);
     
-    virtual HRESULT STDMETHODCALLTYPE elementIsPassword( 
+    virtual HRESULT STDMETHODCALLTYPE elementIsPassword(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ BOOL* result);
     
-    virtual HRESULT STDMETHODCALLTYPE formForElement( 
+    virtual HRESULT STDMETHODCALLTYPE formForElement(
         /* [in] */ IDOMElement* element,
         /* [retval][out] */ IDOMElement** form);
     
-    virtual HRESULT STDMETHODCALLTYPE currentForm( 
+    virtual HRESULT STDMETHODCALLTYPE currentForm(
         /* [retval][out] */ IDOMElement** form);
     
-    virtual HRESULT STDMETHODCALLTYPE controlsInForm( 
+    virtual HRESULT STDMETHODCALLTYPE controlsInForm(
         /* [in] */ IDOMElement* form,
         /* [out][in] */ IDOMElement** controls,
         /* [out][in] */ int* cControls);
     
-    virtual HRESULT STDMETHODCALLTYPE searchForLabels( 
+    /* Deprecated. Use the variant that includes resultDistance and resultIsInCellAbove instead. */
+    virtual HRESULT STDMETHODCALLTYPE deprecatedSearchForLabels(
         /* [size_is][in] */ BSTR *labels,
         /* [in] */ int cLabels,
         /* [in] */ IDOMElement *beforeElement,
         /* [retval][out] */ BSTR *result);
     
-    virtual HRESULT STDMETHODCALLTYPE matchLabels( 
+    virtual HRESULT STDMETHODCALLTYPE matchLabels(
         /* [size_is][in] */ BSTR *labels,
         /* [in] */ int cLabels,
         /* [in] */ IDOMElement *againstElement,
         /* [retval][out] */ BSTR *result);
 
+    virtual HRESULT STDMETHODCALLTYPE searchForLabels(BSTR* labels, unsigned cLabels, IDOMElement* beforeElement, unsigned* resultDistance, BOOL* resultIsInCellAbove, BSTR* result);
+    
     // IWebDocumentRepresentation
-    virtual HRESULT STDMETHODCALLTYPE setDataSource( 
+    virtual HRESULT STDMETHODCALLTYPE setDataSource(
         /* [in] */ IWebDataSource* dataSource);
     
-    virtual HRESULT STDMETHODCALLTYPE receivedData( 
+    virtual HRESULT STDMETHODCALLTYPE receivedData(
         /* [in] */ IStream* data,
         /* [in] */ IWebDataSource* dataSource);
     
-    virtual HRESULT STDMETHODCALLTYPE receivedError( 
+    virtual HRESULT STDMETHODCALLTYPE receivedError(
         /* [in] */ IWebError* error,
         /* [in] */ IWebDataSource* dataSource);
     
-    virtual HRESULT STDMETHODCALLTYPE finishedLoadingWithDataSource( 
+    virtual HRESULT STDMETHODCALLTYPE finishedLoadingWithDataSource(
         /* [in] */ IWebDataSource* dataSource);
     
-    virtual HRESULT STDMETHODCALLTYPE canProvideDocumentSource( 
+    virtual HRESULT STDMETHODCALLTYPE canProvideDocumentSource(
         /* [retval][out] */ BOOL* result);
     
-    virtual HRESULT STDMETHODCALLTYPE documentSource( 
+    virtual HRESULT STDMETHODCALLTYPE documentSource(
         /* [retval][out] */ BSTR* source);
     
-    virtual HRESULT STDMETHODCALLTYPE title( 
+    virtual HRESULT STDMETHODCALLTYPE title(
         /* [retval][out] */ BSTR* docTitle);
 
 protected:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list