* Fix GraphicsContext::drawFocusRing to also draw single focus rects.
* Implemented QWebPage::focusNextPrevChild by sending fake tab/shift-tab events
and make the return value depend on whether we successfully determined a focusable
node or not.
* Changed QWebView::focusNextPrevChild() to call the base QWidget implementation correctly
if we could not handle the focus chain ourselves.
* Changed the focus policy of QWebView to correctly use WheelFocus instead of ClickFocus.
* Made ChromeClientQt::canTakeFocus() and takeFocus() dummy method since they are only
used to control the situation of stepping out of the focus chain inside the page.
* Made inclusion of links in the focus chain configurable through QWebSettings::LinksIncludedInFocusChain.
The layout tests expect this to be disabled but for the user it seems sensible to have it
on by default, hence the default in qwebsettings.cpp
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29689
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
Reviewed by Holger.
+ Fix focus chain handling and cycling through focusable objects (links) using tab/backtab.
+
+ * Fix GraphicsContext::drawFocusRing to also draw single focus rects.
+ * Implemented QWebPage::focusNextPrevChild by sending fake tab/shift-tab events
+ and make the return value depend on whether we successfully determined a focusable
+ node or not.
+ * Changed QWebView::focusNextPrevChild() to call the base QWidget implementation correctly
+ if we could not handle the focus chain ourselves.
+ * Changed the focus policy of QWebView to correctly use WheelFocus instead of ClickFocus.
+ * Made ChromeClientQt::canTakeFocus() and takeFocus() dummy method since they are only
+ used to control the situation of stepping out of the focus chain inside the page.
+ * Made inclusion of links in the focus chain configurable through QWebSettings::LinksIncludedInFocusChain.
+ The layout tests expect this to be disabled but for the user it seems sensible to have it
+ on by default, hence the default in qwebsettings.cpp
+
+ * platform/graphics/qt/GraphicsContextQt.cpp:
+ (WebCore::GraphicsContext::drawFocusRing):
+
+2008-01-21 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger.
+
Fix access key support and fast/forms/legend-access-key.html
SVN revision 26664 changed the default access key for the non-mac build to Alt
const Vector<IntRect>& rects = focusRingRects();
unsigned rectCount = rects.size();
- if (rects.size() > 1)
- {
- QPainterPath path;
- for (int i = 0; i < rectCount; ++i)
- path.addRect(QRectF(rects[i]));
- QPainter *p = m_data->p();
- p->save();
- QPen nPen = p->pen();
- nPen.setColor(color);
- p->setBrush(Qt::NoBrush);
- nPen.setStyle(Qt::DotLine);
- p->setPen(nPen);
+ if (rects.size() == 0)
+ return;
+
+ QPainterPath path;
+ for (int i = 0; i < rectCount; ++i)
+ path.addRect(QRectF(rects[i]));
+ QPainter *p = m_data->p();
+
+ const QPen oldPen = p->pen();
+ const QBrush oldBrush = p->brush();
+
+ QPen nPen = p->pen();
+ nPen.setColor(color);
+ p->setBrush(Qt::NoBrush);
+ nPen.setStyle(Qt::DotLine);
+ p->setPen(nPen);
#if 0
- // FIXME How do we do a bounding outline with Qt?
- QPainterPathStroker stroker;
- QPainterPath newPath = stroker.createStroke(path);
- p->strokePath(newPath, nPen);
+ // FIXME How do we do a bounding outline with Qt?
+ QPainterPathStroker stroker;
+ QPainterPath newPath = stroker.createStroke(path);
+ p->strokePath(newPath, nPen);
#else
- p->drawRect(path.boundingRect());
+ p->drawRect(path.boundingRect());
#endif
- p->restore();
- }
+ p->setPen(oldPen);
+ p->setBrush(oldBrush);
}
void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing)
*/
bool QWebPage::focusNextPrevChild(bool next)
{
- Q_UNUSED(next)
- return false;
+ QKeyEvent ev(QEvent::KeyPress, Qt::Key_Tab, Qt::KeyboardModifiers(next ? Qt::NoModifier : Qt::ShiftModifier));
+ d->keyPressEvent(&ev);
+ bool hasFocusedNode = false;
+ Frame *frame = d->page->focusController()->focusedFrame();
+ if (frame) {
+ Document *document = frame->document();
+ hasFocusedNode = document && document->focusedNode();
+ }
+ //qDebug() << "focusNextPrevChild(" << next << ") =" << ev.isAccepted() << "focusedNode?" << hasFocusedNode;
+ return hasFocusedNode;
}
/*!
d->attributes.insert(QWebSettings::AutoLoadImages, true);
d->attributes.insert(QWebSettings::JavascriptEnabled, true);
+ d->attributes.insert(QWebSettings::LinksIncludedInFocusChain, true);
}
/*!
PrivateBrowsingEnabled,
JavascriptCanOpenWindows,
JavascriptCanAccessClipboard,
- DeveloperExtrasEnabled
+ DeveloperExtrasEnabled,
+ LinksIncludedInFocusChain
};
enum WebGraphic {
MissingImageGraphic,
setAcceptDrops(true);
setMouseTracking(true);
- setFocusPolicy(Qt::ClickFocus);
+ setFocusPolicy(Qt::WheelFocus);
}
/*!
*/
bool QWebView::focusNextPrevChild(bool next)
{
- if (d->page)
- return d->page->focusNextPrevChild(next);
+ if (d->page && d->page->focusNextPrevChild(next))
+ return true;
return QWidget::focusNextPrevChild(next);
}
+2008-01-21 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger.
+
+ Fix focus chain handling and cycling through focusable objects (links) using tab/backtab.
+
+ * Fix GraphicsContext::drawFocusRing to also draw single focus rects.
+ * Implemented QWebPage::focusNextPrevChild by sending fake tab/shift-tab events
+ and make the return value depend on whether we successfully determined a focusable
+ node or not.
+ * Changed QWebView::focusNextPrevChild() to call the base QWidget implementation correctly
+ if we could not handle the focus chain ourselves.
+ * Changed the focus policy of QWebView to correctly use WheelFocus instead of ClickFocus.
+ * Made ChromeClientQt::canTakeFocus() and takeFocus() dummy method since they are only
+ used to control the situation of stepping out of the focus chain inside the page.
+ * Made inclusion of links in the focus chain configurable through QWebSettings::LinksIncludedInFocusChain.
+ The layout tests expect this to be disabled but for the user it seems sensible to have it
+ on by default, hence the default in qwebsettings.cpp
+
+
+ * Api/qwebpage.cpp:
+ (QWebPage::focusNextPrevChild):
+ * Api/qwebsettings.cpp:
+ (QWebSettings::QWebSettings):
+ * Api/qwebsettings.h:
+ * Api/qwebview.cpp:
+ (QWebView::QWebView):
+ (QWebView::focusNextPrevChild):
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::canTakeFocus):
+ (WebCore::ChromeClientQt::takeFocus):
+
2008-01-18 Simon Hausmann <hausmann@webkit.org>
Reviewed by Holger.
bool ChromeClientQt::canTakeFocus(FocusDirection)
{
- if (!m_webPage)
- return false;
- QWidget* view = m_webPage->view();
- if (!view)
- return false;
- return view->focusPolicy() != Qt::NoFocus;
+ // This is called when cycling through links/focusable objects and we
+ // reach the last focusable object. Then we want to claim that we can
+ // take the focus to avoid wrapping.
+ return true;
}
void ChromeClientQt::takeFocus(FocusDirection)
{
- if (!m_webPage)
- return;
- QWidget* view = m_webPage->view();
- if (!view)
- return;
- view->clearFocus();
+ // don't do anything. This is only called when cycling to links/focusable objects,
+ // which in turn is called from focusNextPrevChild. We let focusNextPrevChild
+ // call QWidget::focusNextPrevChild accordingly, so there is no need to do anything
+ // here.
}
bool ChromeClientQt::tabsToLinks() const
{
- return false;
+ return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain);
}
IntRect ChromeClientQt::windowResizerRect() const
+2008-01-21 Simon Hausmann <hausmann@webkit.org>
+
+ Reviewed by Holger.
+
+ Fix focus chain handling and cycling through focusable objects (links) using tab/backtab.
+
+ * Fix GraphicsContext::drawFocusRing to also draw single focus rects.
+ * Implemented QWebPage::focusNextPrevChild by sending fake tab/shift-tab events
+ and make the return value depend on whether we successfully determined a focusable
+ node or not.
+ * Changed QWebView::focusNextPrevChild() to call the base QWidget implementation correctly
+ if we could not handle the focus chain ourselves.
+ * Changed the focus policy of QWebView to correctly use WheelFocus instead of ClickFocus.
+ * Made ChromeClientQt::canTakeFocus() and takeFocus() dummy method since they are only
+ used to control the situation of stepping out of the focus chain inside the page.
+ * Made inclusion of links in the focus chain configurable through QWebSettings::LinksIncludedInFocusChain.
+ The layout tests expect this to be disabled but for the user it seems sensible to have it
+ on by default, hence the default in qwebsettings.cpp
+
+
+ * DumpRenderTree/qt/DumpRenderTree.cpp:
+ (WebCore::WebPage::WebPage):
+
2008-01-19 Mark Rowe <mrowe@apple.com>
Reviewed by Alp Toker.
{
settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
+ settings()->setAttribute(QWebSettings::LinksIncludedInFocusChain, false);
connect(this, SIGNAL(geometryChangeRequest(const QRect &)),
this, SLOT(setViewGeometry(const QRect & )));
}