[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
trey
trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:36:48 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 6b6b406ed09825103851992db68d189822b024c7
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Apr 14 05:18:45 2003 +0000
3219720 - autofill mapping confused by tables, worse than MacIE (at store.apple.com)
If in scanning backwards we get to the end of a table row, we take a diversion
and scan the cell that is above the cell we started at.
Big improvement for store.apple.com.
Reviewed by Maciej
* khtml/rendering/render_table.cpp:
(RenderTable::cellAbove): New support routine to find the cell above another
* khtml/rendering/render_table.h:
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::searchForLabelsAboveCell):
Get the cell above, scan its tree for matching text.
(KWQKHTMLPart::searchForLabelsBeforeElement):
Call above routine if we are working within a table
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index f5cf8c0..13377e9 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,23 @@
+2003-04-13 Trey Matteson <trey at apple.com>
+
+ 3219720 - autofill mapping confused by tables, worse than MacIE (at store.apple.com)
+
+ If in scanning backwards we get to the end of a table row, we take a diversion
+ and scan the cell that is above the cell we started at.
+ Big improvement for store.apple.com.
+
+ Reviewed by Maciej
+
+ * khtml/rendering/render_table.cpp:
+ (RenderTable::cellAbove): New support routine to find the cell above another
+ * khtml/rendering/render_table.h:
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::searchForLabelsAboveCell):
+ Get the cell above, scan its tree for matching text.
+ (KWQKHTMLPart::searchForLabelsBeforeElement):
+ Call above routine if we are working within a table
+
2003-04-12 Chris Blumenberg <cblu at apple.com>
Fixed: 3188070 - 6I32 EMBED tag with no SRC attribute doesn't load the plugin
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f5cf8c0..13377e9 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,23 @@
+2003-04-13 Trey Matteson <trey at apple.com>
+
+ 3219720 - autofill mapping confused by tables, worse than MacIE (at store.apple.com)
+
+ If in scanning backwards we get to the end of a table row, we take a diversion
+ and scan the cell that is above the cell we started at.
+ Big improvement for store.apple.com.
+
+ Reviewed by Maciej
+
+ * khtml/rendering/render_table.cpp:
+ (RenderTable::cellAbove): New support routine to find the cell above another
+ * khtml/rendering/render_table.h:
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::searchForLabelsAboveCell):
+ Get the cell above, scan its tree for matching text.
+ (KWQKHTMLPart::searchForLabelsBeforeElement):
+ Call above routine if we are working within a table
+
2003-04-12 Chris Blumenberg <cblu at apple.com>
Fixed: 3188070 - 6I32 EMBED tag with no SRC attribute doesn't load the plugin
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index 6a979f1..f2326a8 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -616,6 +616,44 @@ RenderObject* RenderTable::removeChildNode(RenderObject* child)
return RenderContainer::removeChildNode( child );
}
+#if APPLE_CHANGES
+RenderTableCell* RenderTable::cellAbove(RenderTableCell* cell) const
+{
+ // Find the section and row to look in
+ int r = cell->row();
+ RenderTableSection *section;
+ int rAbove;
+ if (r > 0) {
+ // cell is not in the first row, so use the above row in its own section
+ section = cell->section();
+ rAbove = r-1;
+ } else {
+ // cell is at top of a section, use last row in previous section
+ RenderObject *prevSection = cell->section()->previousSibling();
+ while (prevSection && !prevSection->isTableSection()) {
+ prevSection = prevSection->previousSibling();
+ }
+ section = static_cast<RenderTableSection *>(prevSection);
+ if (section) {
+ rAbove = section->numRows()-1;
+ }
+ }
+
+ // Look up the cell in the section's grid, which required effective col index
+ if (section) {
+ int effCol = colToEffCol(cell->col());
+ RenderTableCell* aboveCell;
+ // If we hit a span back up to a real cell.
+ do {
+ aboveCell = section->cellAt(rAbove, effCol);
+ effCol--;
+ } while (aboveCell == (RenderTableCell *)-1 && effCol >=0);
+ return (aboveCell == (RenderTableCell *)-1) ? 0 : aboveCell;
+ } else {
+ return 0;
+ }
+}
+#endif
#ifndef NDEBUG
void RenderTable::dump(QTextStream *stream, QString ind) const
diff --git a/WebCore/khtml/rendering/render_table.h b/WebCore/khtml/rendering/render_table.h
index 305cf05..3e78bde 100644
--- a/WebCore/khtml/rendering/render_table.h
+++ b/WebCore/khtml/rendering/render_table.h
@@ -160,6 +160,9 @@ public:
void setNeedSectionRecalc() { needSectionRecalc = true; }
virtual RenderObject* removeChildNode(RenderObject* child);
+#if APPLE_CHANGES
+ virtual RenderTableCell* cellAbove(RenderTableCell* cell) const;
+#endif
protected:
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 17bf730..35d33b7 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -30,6 +30,7 @@
#include "dom_nodeimpl.h"
#include "html_formimpl.h"
+#include "html_tableimpl.h"
#include <CoreFoundation/CoreFoundation.h>
@@ -190,6 +191,7 @@ public:
void recordFormValue(const QString &name, const QString &value, DOM::HTMLFormElementImpl *element);
DOM::HTMLFormElementImpl *currentForm() const;
+ NSString *searchForLabelsAboveCell(QRegExp *regExp, DOM::HTMLTableCellElementImpl *cell);
NSString *searchForLabelsBeforeElement(NSArray *labels, DOM::ElementImpl *element);
NSString *matchLabelsAgainstElement(NSArray *labels, DOM::ElementImpl *element);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index c979497..09fc2cb 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -29,6 +29,7 @@
#import "html_documentimpl.h"
#import "render_root.h"
#import "render_frames.h"
+#import "render_table.h"
#import "render_text.h"
#import "khtmlpart_p.h"
#import "khtmlview.h"
@@ -72,6 +73,7 @@ using khtml::RenderRoot;
using khtml::RenderStyle;
using khtml::RenderText;
using khtml::RenderWidget;
+using khtml::RenderTableCell;
using khtml::VISIBLE;
using KIO::Job;
@@ -304,17 +306,46 @@ QRegExp *regExpForLabels(NSArray *labels)
}
return result;
}
-
+
+NSString *KWQKHTMLPart::searchForLabelsAboveCell(QRegExp *regExp, HTMLTableCellElementImpl *cell)
+{
+ RenderTableCell *cellRenderer = static_cast<RenderTableCell *>(cell->renderer());
+ RenderTableCell *cellAboveRenderer = cellRenderer->table()->cellAbove(cellRenderer);
+
+ if (cellAboveRenderer) {
+ HTMLTableCellElementImpl *aboveCell =
+ static_cast<HTMLTableCellElementImpl *>(cellAboveRenderer->element());
+
+ // search within the above cell we found for a match
+ for (NodeImpl *n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
+ if (idFromNode(n) == ID_TEXT
+ && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
+ {
+ // For each text chunk, run the regexp
+ QString nodeString = n->nodeValue().string();
+ int pos = regExp->searchRev(nodeString);
+ if (pos >= 0) {
+ return nodeString.mid(pos, regExp->matchedLength()).getNSString();
+ }
+ }
+ }
+ }
+ // Any reason in practice to search all cells in that are above cell?
+ return nil;
+}
NSString *KWQKHTMLPart::searchForLabelsBeforeElement(NSArray *labels, ElementImpl *element)
{
QRegExp *regExp = regExpForLabels(labels);
// We stop searching after we've seen this many chars
const unsigned int charsSearchedThreshold = 500;
- // This is the absolute max we search. We allow a little more slop, to
- // make it more likely that we'll search whole nodes
+ // This is the absolute max we search. We allow a little more slop than
+ // charsSearchedThreshold, to make it more likely that we'll search whole nodes.
const unsigned int maxCharsSearched = 600;
-
+ // If the starting element is within a table, the cell that contains it
+ HTMLTableCellElementImpl *startingTableCell = 0;
+ bool searchedCellAbove = false;
+
// walk backwards in the node tree, until another element, or form, or end of tree
int unsigned lengthSearched = 0;
NodeImpl *n;
@@ -329,6 +360,14 @@ NSString *KWQKHTMLPart::searchForLabelsBeforeElement(NSArray *labels, ElementImp
{
// We hit another form element or the start of the form - bail out
break;
+ } else if (nodeID == ID_TD && !startingTableCell) {
+ startingTableCell = static_cast<HTMLTableCellElementImpl *>(n);
+ } else if (nodeID == ID_TR && startingTableCell) {
+ NSString *result = searchForLabelsAboveCell(regExp, startingTableCell);
+ if (result) {
+ return result;
+ }
+ searchedCellAbove = true;
} else if (nodeID == ID_TEXT
&& n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
{
@@ -346,7 +385,14 @@ NSString *KWQKHTMLPart::searchForLabelsBeforeElement(NSArray *labels, ElementImp
}
}
}
- return nil;
+
+ // 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, startingTableCell);
+ } else {
+ return nil;
+ }
}
NSString *KWQKHTMLPart::matchLabelsAgainstElement(NSArray *labels, ElementImpl *element)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list