[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:08:22 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8a3143a52f2256fd518203a4a75b6a9b1f5038e4
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 31 23:40:37 2003 +0000
Fix for 3470007, links don't get focus on mouse down. Fix the focus check on mouse down to actually
crawl up the content tree in order to find the nearest enclosing focusable node. Also clean up and
fix checks that improperly blurred the link after it got focused.
Fix for 3450335, AppKit widgets not obeying their desired focus policies. I renamed isSelectable to
isFocusable and then also added isMouseFocusable and isKeyboardFocusable methods.
Reviewed by kocienda
* khtml/css/html4.css:
* khtml/html/html_baseimpl.cpp:
(HTMLFrameElementImpl::isFocusable):
* khtml/html/html_baseimpl.h:
* khtml/html/html_formimpl.cpp:
(HTMLGenericFormElementImpl::isFocusable):
(HTMLGenericFormElementImpl::isKeyboardFocusable):
(HTMLGenericFormElementImpl::isMouseFocusable):
* khtml/html/html_formimpl.h:
* khtml/html/html_inlineimpl.cpp:
(HTMLAnchorElementImpl::isFocusable):
* khtml/html/html_inlineimpl.h:
* khtml/khtmlview.cpp:
(KHTMLView::dispatchMouseEvent):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::nextFocusNode):
(DocumentImpl::previousFocusNode):
* khtml/xml/dom_nodeimpl.cpp:
(NodeImpl::isFocusable):
(NodeImpl::isKeyboardFocusable):
(NodeImpl::isMouseFocusable):
* khtml/xml/dom_nodeimpl.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::khtmlMousePressEvent):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 944a12e..3bb75a9 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,39 @@
+2003-10-31 David Hyatt <hyatt at apple.com>
+
+ Fix for 3470007, links don't get focus on mouse down. Fix the focus check on mouse down to actually
+ crawl up the content tree in order to find the nearest enclosing focusable node. Also clean up and
+ fix checks that improperly blurred the link after it got focused.
+
+ Fix for 3450335, AppKit widgets not obeying their desired focus policies. I renamed isSelectable to
+ isFocusable and then also added isMouseFocusable and isKeyboardFocusable methods.
+
+ Reviewed by kocienda
+
+ * khtml/css/html4.css:
+ * khtml/html/html_baseimpl.cpp:
+ (HTMLFrameElementImpl::isFocusable):
+ * khtml/html/html_baseimpl.h:
+ * khtml/html/html_formimpl.cpp:
+ (HTMLGenericFormElementImpl::isFocusable):
+ (HTMLGenericFormElementImpl::isKeyboardFocusable):
+ (HTMLGenericFormElementImpl::isMouseFocusable):
+ * khtml/html/html_formimpl.h:
+ * khtml/html/html_inlineimpl.cpp:
+ (HTMLAnchorElementImpl::isFocusable):
+ * khtml/html/html_inlineimpl.h:
+ * khtml/khtmlview.cpp:
+ (KHTMLView::dispatchMouseEvent):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::nextFocusNode):
+ (DocumentImpl::previousFocusNode):
+ * khtml/xml/dom_nodeimpl.cpp:
+ (NodeImpl::isFocusable):
+ (NodeImpl::isKeyboardFocusable):
+ (NodeImpl::isMouseFocusable):
+ * khtml/xml/dom_nodeimpl.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::khtmlMousePressEvent):
+
2003-10-31 Ken Kocienda <kocienda at apple.com>
Reviewed by David
diff --git a/WebCore/khtml/css/html4.css b/WebCore/khtml/css/html4.css
index be2178c..b268bc4 100644
--- a/WebCore/khtml/css/html4.css
+++ b/WebCore/khtml/css/html4.css
@@ -432,9 +432,9 @@ acronym {
:focus { outline: -apple-aqua 5px }
a:link { color: #0000EE; text-decoration: underline; }
-a:link:active { color: red; outline: -apple-aqua 5px; }
+a:link:active { color: red; }
a:visited { color: #551A8B; text-decoration: underline; }
-a:visited:active { color: red; outline: -apple-aqua 5px; }
+a:visited:active { color: red; }
/* ### :before is now supported, but we haven't tried reinstating this
### rule that was comment out long ago.
diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp
index c2b9f4a..aab9d87 100644
--- a/WebCore/khtml/html/html_baseimpl.cpp
+++ b/WebCore/khtml/html/html_baseimpl.cpp
@@ -433,7 +433,7 @@ void HTMLFrameElementImpl::setLocation( const DOMString& str )
updateForNewURL();
}
-bool HTMLFrameElementImpl::isSelectable() const
+bool HTMLFrameElementImpl::isFocusable() const
{
return m_render!=0;
}
diff --git a/WebCore/khtml/html/html_baseimpl.h b/WebCore/khtml/html/html_baseimpl.h
index a2b6108..e8a53cd 100644
--- a/WebCore/khtml/html/html_baseimpl.h
+++ b/WebCore/khtml/html/html_baseimpl.h
@@ -90,7 +90,7 @@ public:
bool noResize() { return noresize; }
void setLocation( const DOMString& str );
- virtual bool isSelectable() const;
+ virtual bool isFocusable() const;
virtual void setFocus(bool);
DocumentImpl* contentDocument() const;
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index 8f0f62e..4244113 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -813,15 +813,31 @@ void HTMLGenericFormElementImpl::recalcStyle( StyleChange ch )
m_render->updateFromElement();
}
-bool HTMLGenericFormElementImpl::isSelectable() const
+bool HTMLGenericFormElementImpl::isFocusable() const
{
if (!m_render || (m_render->style() && m_render->style()->visibility() != VISIBLE))
return false;
- if (m_render->isWidget()) {
+ return true;
+}
+
+bool HTMLGenericFormElementImpl::isKeyboardFocusable() const
+{
+ if (isFocusable() && m_render->isWidget()) {
return static_cast<RenderWidget*>(m_render)->widget() &&
- static_cast<RenderWidget*>(m_render)->widget()->focusPolicy() >= QWidget::TabFocus;
+ ((static_cast<RenderWidget*>(m_render)->widget()->focusPolicy() == QWidget::TabFocus) ||
+ (static_cast<RenderWidget*>(m_render)->widget()->focusPolicy() == QWidget::StrongFocus));
}
- return true;
+ return false;
+}
+
+bool HTMLGenericFormElementImpl::isMouseFocusable() const
+{
+ if (isFocusable() && m_render->isWidget()) {
+ return static_cast<RenderWidget*>(m_render)->widget() &&
+ ((static_cast<RenderWidget*>(m_render)->widget()->focusPolicy() == QWidget::ClickFocus) ||
+ (static_cast<RenderWidget*>(m_render)->widget()->focusPolicy() == QWidget::StrongFocus));
+ }
+ return false;
}
void HTMLGenericFormElementImpl::defaultEventHandler(EventImpl *evt)
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index bf57e80..37444ae 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -148,7 +148,9 @@ public:
virtual bool disabled() const;
void setDisabled(bool _disabled);
- virtual bool isSelectable() const;
+ virtual bool isFocusable() const;
+ virtual bool isKeyboardFocusable() const;
+ virtual bool isMouseFocusable() const;
virtual bool isEnumeratable() const { return false; }
bool readOnly() const { return m_readOnly; }
diff --git a/WebCore/khtml/html/html_inlineimpl.cpp b/WebCore/khtml/html/html_inlineimpl.cpp
index 1eb6496..8b01b33 100644
--- a/WebCore/khtml/html/html_inlineimpl.cpp
+++ b/WebCore/khtml/html/html_inlineimpl.cpp
@@ -53,7 +53,7 @@ HTMLAnchorElementImpl::~HTMLAnchorElementImpl()
{
}
-bool HTMLAnchorElementImpl::isSelectable() const
+bool HTMLAnchorElementImpl::isFocusable() const
{
return m_hasAnchor &&
m_render &&
diff --git a/WebCore/khtml/html/html_inlineimpl.h b/WebCore/khtml/html/html_inlineimpl.h
index 88eb4de..4645b12 100644
--- a/WebCore/khtml/html/html_inlineimpl.h
+++ b/WebCore/khtml/html/html_inlineimpl.h
@@ -36,7 +36,7 @@ public:
HTMLAnchorElementImpl(DocumentPtr *doc);
~HTMLAnchorElementImpl();
- virtual bool isSelectable() const;
+ virtual bool isFocusable() const;
virtual Id id() const;
virtual void parseAttribute(AttributeImpl *attr);
virtual void defaultEventHandler(EventImpl *evt);
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 769da6e..dd7f17e 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -1663,17 +1663,12 @@ bool KHTMLView::dispatchMouseEvent(int eventId, DOM::NodeImpl *targetNode, bool
}
else if (eventId == EventImpl::MOUSEDOWN_EVENT) {
// Focus should be shifted on mouse down, not on a click. -dwh
- if (targetNode->isSelectable())
- m_part->xmlDocImpl()->setFocusNode(targetNode);
-#if !APPLE_CHANGES
- // In Safari we don't want to take the focus away from a text field
- // when we click on, say, a form button. But I suspect this could be
- // something specific to Macintosh, so I am leaving this code here inside
- // !APPLE_CHANGES. This will probably change when we do more of the keyboard
- // navigation work.
- else
+ DOM::NodeImpl* nodeImpl = targetNode;
+ for ( ; nodeImpl && !nodeImpl->isFocusable(); nodeImpl = nodeImpl->parentNode());
+ if (nodeImpl && nodeImpl->isMouseFocusable())
+ m_part->xmlDocImpl()->setFocusNode(nodeImpl);
+ else if (!nodeImpl || !nodeImpl->isKeyboardFocusable())
m_part->xmlDocImpl()->setFocusNode(0);
-#endif
}
}
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 9470bc1..837cd82 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1317,7 +1317,7 @@ NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
int lowestTabIndex = 65535;
for (n = this; n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable()) {
+ if (n->isKeyboardFocusable()) {
if ((n->tabIndex() > 0) && (n->tabIndex() < lowestTabIndex))
lowestTabIndex = n->tabIndex();
}
@@ -1328,7 +1328,7 @@ NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
// Go to the first node in the document that has the desired tab index
for (n = this; n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable() && (n->tabIndex() == lowestTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == lowestTabIndex))
return n;
}
@@ -1341,7 +1341,7 @@ NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
if (fromTabIndex == 0) {
// Just need to find the next selectable node after fromNode (in document order) that doesn't have a tab index
NodeImpl *n = fromNode->traverseNextNode();
- while (n && !(n->isSelectable() && n->tabIndex() == 0))
+ while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))
n = n->traverseNextNode();
return n;
}
@@ -1355,7 +1355,7 @@ NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
bool reachedFromNode = false;
for (n = this; n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable() &&
+ if (n->isKeyboardFocusable() &&
((reachedFromNode && (n->tabIndex() >= fromTabIndex)) ||
(!reachedFromNode && (n->tabIndex() > fromTabIndex))) &&
(n->tabIndex() < lowestSuitableTabIndex) &&
@@ -1373,20 +1373,20 @@ NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
if (lowestSuitableTabIndex == 65535) {
// No next node with a tab index -> just take first node with tab index of 0
NodeImpl *n = this;
- while (n && !(n->isSelectable() && n->tabIndex() == 0))
+ while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))
n = n->traverseNextNode();
return n;
}
// Search forwards from fromNode
for (n = fromNode->traverseNextNode(); n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable() && (n->tabIndex() == lowestSuitableTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex))
return n;
}
// The next node isn't after fromNode, start from the beginning of the document
for (n = this; n != fromNode; n = n->traverseNextNode()) {
- if (n->isSelectable() && (n->tabIndex() == lowestSuitableTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == lowestSuitableTabIndex))
return n;
}
@@ -1407,7 +1407,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
int highestTabIndex = 0;
for (n = lastNode; n != 0; n = n->traversePreviousNode()) {
- if (n->isSelectable()) {
+ if (n->isKeyboardFocusable()) {
if (n->tabIndex() == 0)
return n;
else if (n->tabIndex() > highestTabIndex)
@@ -1417,7 +1417,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
// No node with a tab index of 0; just go to the last node with the highest tab index
for (n = lastNode; n != 0; n = n->traversePreviousNode()) {
- if (n->isSelectable() && (n->tabIndex() == highestTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex))
return n;
}
@@ -1429,7 +1429,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
if (fromTabIndex == 0) {
// Find the previous selectable node before fromNode (in document order) that doesn't have a tab index
NodeImpl *n = fromNode->traversePreviousNode();
- while (n && !(n->isSelectable() && n->tabIndex() == 0))
+ while (n && !(n->isKeyboardFocusable() && n->tabIndex() == 0))
n = n->traversePreviousNode();
if (n)
return n;
@@ -1437,7 +1437,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
// No previous nodes with a 0 tab index, go to the last node in the document that has the highest tab index
int highestTabIndex = 0;
for (n = this; n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable() && (n->tabIndex() > highestTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() > highestTabIndex))
highestTabIndex = n->tabIndex();
}
@@ -1445,7 +1445,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
return 0;
for (n = lastNode; n != 0; n = n->traversePreviousNode()) {
- if (n->isSelectable() && (n->tabIndex() == highestTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == highestTabIndex))
return n;
}
@@ -1462,7 +1462,7 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
bool reachedFromNode = false;
for (n = this; n != 0; n = n->traverseNextNode()) {
- if (n->isSelectable() &&
+ if (n->isKeyboardFocusable() &&
((!reachedFromNode && (n->tabIndex() <= fromTabIndex)) ||
(reachedFromNode && (n->tabIndex() < fromTabIndex))) &&
(n->tabIndex() > highestSuitableTabIndex) &&
@@ -1485,12 +1485,12 @@ NodeImpl *DocumentImpl::previousFocusNode(NodeImpl *fromNode)
// Search backwards from fromNode
for (n = fromNode->traversePreviousNode(); n != 0; n = n->traversePreviousNode()) {
- if (n->isSelectable() && (n->tabIndex() == highestSuitableTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))
return n;
}
// The previous node isn't before fromNode, start from the end of the document
for (n = lastNode; n != fromNode; n = n->traversePreviousNode()) {
- if (n->isSelectable() && (n->tabIndex() == highestSuitableTabIndex))
+ if (n->isKeyboardFocusable() && (n->tabIndex() == highestSuitableTabIndex))
return n;
}
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index ae793d0..b139ad7 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -358,11 +358,21 @@ bool NodeImpl::isInline() const
return !isElementNode();
}
-bool NodeImpl::isSelectable() const
+bool NodeImpl::isFocusable() const
{
return false;
}
+bool NodeImpl::isKeyboardFocusable() const
+{
+ return isFocusable();
+}
+
+bool NodeImpl::isMouseFocusable() const
+{
+ return isFocusable();
+}
+
unsigned long NodeImpl::nodeIndex() const
{
NodeImpl *_tempNode = previousSibling();
diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h
index d1e3acc..57dae26 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.h
+++ b/WebCore/khtml/xml/dom_nodeimpl.h
@@ -202,8 +202,10 @@ public:
/**
* whether this node can receive the keyboard focus.
*/
- virtual bool isSelectable() const;
-
+ virtual bool isFocusable() const;
+ virtual bool isKeyboardFocusable() const;
+ virtual bool isMouseFocusable() const;
+
virtual bool isInline() const;
virtual QString toHTML() const;
QString recursive_toHTML(bool start = false) const;
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index e3b7899..976af53 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1532,11 +1532,6 @@ void KWQKHTMLPart::khtmlMousePressEvent(MousePressEvent *event)
}
KWQ_UNBLOCK_EXCEPTIONS;
- // remove focus from links
- DocumentImpl *doc = xmlDocImpl();
- if (doc)
- doc->setFocusNode(0);
-
KHTMLPart::khtmlMousePressEvent(event);
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list