#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
FocusRing* focusRing = impl->focusRing();
if (focusRing) {
- if (event->type == EWK_GESTURE_TAP && event->count == 1) {
- focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
+ if (event->type == EWK_GESTURE_TAP) {
+ if (event->count == 1)
+ focusRing->requestToShow(IntPoint(event->position.x, event->position.y));
} else if (event->type == EWK_GESTURE_PAN) {
if (impl->exceedTouchMoveThreshold)
focusRing->requestToHide();
- } else {
- if (event->type != EWK_GESTURE_LONG_PRESS) {
+ } else if (event->type != EWK_GESTURE_LONG_PRESS) {
#if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2)
- if (!impl->pageClient->isContextMenuVisible())
+ if (!impl->pageClient->isContextMenuVisible())
#endif
- focusRing->requestToHide();
- }
+ focusRing->requestToHide();
}
}
#endif
RenderObject* renderer = node->renderer();
FrameView* view = node->document()->frame()->view();
-
- IntPoint absolutePoint;
- absolutePoint = view->convertToContainingWindow(view->convertFromRenderer(renderer, absolutePoint));
- renderer->addFocusRingRects(rects, absolutePoint);
-
- if (!rects.isEmpty())
- return;
-
LayoutRect rect;
+
if (node->hasTagName(HTMLNames::areaTag)) {
HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node);
HTMLImageElement* image = area->imageElement();
- if (!image || !image->renderer())
- return;
-
- rect = rectToAbsoluteCoordinates(area->document()->frame(), area->computeRect(area->imageElement()->renderer()));
+ if (image && image->renderer())
+ rect = rectToAbsoluteCoordinates(area->document()->frame(), area->computeRect(area->imageElement()->renderer()));
} else if (node->renderer()) {
if (node->isDocumentNode())
rect = rectToAbsoluteCoordinates(static_cast<Document*>(node)->frame(), static_cast<Document*>(node)->frame()->view()->visibleContentRect());
- else {
- rect = node->getRect();
- rect.intersect(node->renderer()->absoluteClippedOverflowRect());
- rect = rectToAbsoluteCoordinates(node->document()->frame(), rect);
+ else
+ rect = rectToAbsoluteCoordinates(node->document()->frame(), node->renderer()->absoluteClippedOverflowRect());
+ }
- rect.move(node->renderer()->style()->borderLeftWidth(), node->renderer()->style()->borderTopWidth());
- rect.setWidth(rect.width() - node->renderer()->style()->borderLeftWidth() - node->renderer()->style()->borderRightWidth());
- rect.setHeight(rect.height() - node->renderer()->style()->borderTopWidth() - node->renderer()->style()->borderBottomWidth());
- }
+ if (rect.pixelSnappedX() < 0)
+ rect.shiftXEdgeTo(0);
+ if (rect.pixelSnappedY() < 0)
+ rect.shiftYEdgeTo(0);
+
+ if (rect.isEmpty())
+ return;
+
+ IntRect focusedNodeRect(pixelSnappedIntRect(rect));
+ IntPoint absolutePoint;
+ absolutePoint = view->convertToContainingWindow(view->convertFromRenderer(renderer, absolutePoint));
+ Vector<IntRect> candidateRects;
+ renderer->addFocusRingRects(candidateRects, absolutePoint);
+
+ for (size_t i = 0; i < candidateRects.size(); ++i) {
+ IntRect candidate(candidateRects[i]);
+ candidate.intersect(focusedNodeRect);
+ if (!candidate.isEmpty())
+ rects.append(candidate);
}
- rects.append(pixelSnappedIntRect(rect));
+ if (rects.isEmpty())
+ rects.append(focusedNodeRect);
}
#endif