#if ENABLE(TIZEN_WEBKIT2_HIT_TEST)
#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
#if ENABLE(TOUCH_ADJUSTMENT)
+static bool isClickableOrFocusable(Node* focusableNode)
+{
+
+ if (!focusableNode)
+ return false;
+ if (focusableNode->disabled())
+ return false;
+ if (!focusableNode->inDocument())
+ return false;
+ if (!focusableNode->renderer() || focusableNode->renderer()->style()->visibility() != VISIBLE)
+ return false;
+ if (focusableNode->isFocusable()) {
+ if (focusableNode->isLink()
+ || focusableNode->hasTagName(HTMLNames::inputTag)
+ || focusableNode->hasTagName(HTMLNames::selectTag)
+ || focusableNode->hasTagName(HTMLNames::buttonTag))
+ return true;
+ }
+ if (focusableNode->supportsFocus()
+ || focusableNode->hasEventListeners(eventNames().clickEvent)
+ || focusableNode->hasEventListeners(eventNames().mousedownEvent)
+ || focusableNode->hasEventListeners(eventNames().mouseupEvent)) {
+ return true;
+ }
+ return false;
+}
+
static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page, const IntPoint& point, const IntSize& area)
#else
static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page)
Node* adjustedNode = 0;
IntPoint adustedPoint;
Frame* mainFrame = page->mainFrame();
- mainFrame->eventHandler()->bestClickableNodeForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), adustedPoint, adjustedNode);
+ if (!isClickableOrFocusable(node))
+ mainFrame->eventHandler()->bestClickableNodeForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), adustedPoint, adjustedNode);
if (adjustedNode)
node = adjustedNode;
if (renderer && (renderer->isBody() || renderer->isRenderView() || renderer->isRoot()))
break;
- if (focusableNode->isFocusable()) {
- if (focusableNode->isLink()
- || focusableNode->hasTagName(HTMLNames::inputTag)
- || focusableNode->hasTagName(HTMLNames::selectTag)
- || focusableNode->hasTagName(HTMLNames::buttonTag))
- isFocusRingDrawable = true;
- break;
- }
-
- if (focusableNode->supportsFocus()
- || focusableNode->hasEventListeners(eventNames().clickEvent)
- || focusableNode->hasEventListeners(eventNames().mousedownEvent)
- || focusableNode->hasEventListeners(eventNames().mouseupEvent)) {
+ if (isClickableOrFocusable(focusableNode)) {
isFocusRingDrawable = true;
break;
}
focusableNode = focusableNode->parentNode();
}
+ // Don't draw focus ring if child is focusable or has trigger
+ if (focusableNode && focusableNode->isContainerNode() && !focusableNode->isLink()) {
+ WebCore::Node *child = static_cast<const ContainerNode*>(focusableNode)->firstChild();
+ while(child) {
+ if( child->supportsFocus()
+ || child->hasEventListeners(eventNames().clickEvent)
+ || child->hasEventListeners(eventNames().mousedownEvent)
+ || child->hasEventListeners(eventNames().mouseupEvent)) {
+ return IntRect();
+ }
+ child = child->traverseNextNode(focusableNode);
+ }
+ }
+
if (!isFocusRingDrawable) {
if (node->hasTagName(HTMLNames::imgTag))
return getNodeRect(node, node, !hitTestResult.absoluteImageURL().isEmpty());
#else
hitTestResultData.focusedRect = getFocusedRect(hitTestResult, m_page.get());
#endif
+
+ // Don't display FocusRect if the size is too big..
+ IntRect framerect = frameView->visibleContentRect(true);
+ if (hitTestResultData.focusedRect.width() > (0.8 * framerect.width())
+ && hitTestResultData.focusedRect.height() > (0.8 * framerect.height())) {
+ hitTestResultData.focusedRect = IntRect();
+ }
+
if (hitTestResult.innerNode() && hitTestResult.innerNode()->renderer() && hitTestResult.innerNode()->renderer()->style()) {
hitTestResultData.focusedColor = hitTestResult.innerNode()->renderer()->style()->tapHighlightColor();
if (!hitTestResultData.focusedColor.hasAlpha())