| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 // events to frames as they're exited. With gestures, a single event | 1452 // events to frames as they're exited. With gestures, a single event |
| 1453 // conceptually both 'leaves' whatever frame currently had hover and enters a | 1453 // conceptually both 'leaves' whatever frame currently had hover and enters a |
| 1454 // new frame | 1454 // new frame |
| 1455 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, | 1455 void EventHandler::updateGestureHoverActiveState(const HitTestRequest& request, |
| 1456 Element* innerElement) { | 1456 Element* innerElement) { |
| 1457 ASSERT(m_frame == m_frame->localFrameRoot()); | 1457 ASSERT(m_frame == m_frame->localFrameRoot()); |
| 1458 | 1458 |
| 1459 HeapVector<Member<LocalFrame>> newHoverFrameChain; | 1459 HeapVector<Member<LocalFrame>> newHoverFrameChain; |
| 1460 LocalFrame* newHoverFrameInDocument = | 1460 LocalFrame* newHoverFrameInDocument = |
| 1461 innerElement ? innerElement->document().frame() : nullptr; | 1461 innerElement ? innerElement->document().frame() : nullptr; |
| 1462 // Insert the ancestors of the frame having the new hovered node to the frame | 1462 // Insert the ancestors of the frame having the new hovered element to the |
| 1463 // chain The frame chain doesn't include the main frame to avoid the redundant | 1463 // frame chain. The frame chain doesn't include the main frame to avoid the |
| 1464 // work that cleans the hover state. Because the hover state for the main | 1464 // redundant work that cleans the hover state because the hover state for the |
| 1465 // frame is updated by calling Document::updateHoverActiveState | 1465 // main frame is updated by calling Document::updateHoverActiveState. |
| 1466 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { | 1466 while (newHoverFrameInDocument && newHoverFrameInDocument != m_frame) { |
| 1467 newHoverFrameChain.push_back(newHoverFrameInDocument); | 1467 newHoverFrameChain.push_back(newHoverFrameInDocument); |
| 1468 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); | 1468 Frame* parentFrame = newHoverFrameInDocument->tree().parent(); |
| 1469 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() | 1469 newHoverFrameInDocument = parentFrame && parentFrame->isLocalFrame() |
| 1470 ? toLocalFrame(parentFrame) | 1470 ? toLocalFrame(parentFrame) |
| 1471 : nullptr; | 1471 : nullptr; |
| 1472 } | 1472 } |
| 1473 | 1473 |
| 1474 Node* oldHoverNodeInCurDoc = m_frame->document()->hoverNode(); | 1474 Element* oldHoverElementInCurDoc = m_frame->document()->hoverElement(); |
| 1475 Node* newInnermostHoverNode = innerElement; | 1475 Element* newInnermostHoverElement = innerElement; |
| 1476 | 1476 |
| 1477 if (newInnermostHoverNode != oldHoverNodeInCurDoc) { | 1477 if (newInnermostHoverElement != oldHoverElementInCurDoc) { |
| 1478 size_t indexFrameChain = newHoverFrameChain.size(); | 1478 size_t indexFrameChain = newHoverFrameChain.size(); |
| 1479 | 1479 |
| 1480 // Clear the hover state on any frames which are no longer in the frame | 1480 // Clear the hover state on any frames which are no longer in the frame |
| 1481 // chain of the hovered element. | 1481 // chain of the hovered element. |
| 1482 while (oldHoverNodeInCurDoc && | 1482 while (oldHoverElementInCurDoc && |
| 1483 oldHoverNodeInCurDoc->isFrameOwnerElement()) { | 1483 oldHoverElementInCurDoc->isFrameOwnerElement()) { |
| 1484 LocalFrame* newHoverFrame = nullptr; | 1484 LocalFrame* newHoverFrame = nullptr; |
| 1485 // If we can't get the frame from the new hover frame chain, | 1485 // If we can't get the frame from the new hover frame chain, |
| 1486 // the newHoverFrame will be null and the old hover state will be cleared. | 1486 // the newHoverFrame will be null and the old hover state will be cleared. |
| 1487 if (indexFrameChain > 0) | 1487 if (indexFrameChain > 0) |
| 1488 newHoverFrame = newHoverFrameChain[--indexFrameChain]; | 1488 newHoverFrame = newHoverFrameChain[--indexFrameChain]; |
| 1489 | 1489 |
| 1490 HTMLFrameOwnerElement* owner = | 1490 HTMLFrameOwnerElement* owner = |
| 1491 toHTMLFrameOwnerElement(oldHoverNodeInCurDoc); | 1491 toHTMLFrameOwnerElement(oldHoverElementInCurDoc); |
| 1492 if (!owner->contentFrame() || !owner->contentFrame()->isLocalFrame()) | 1492 if (!owner->contentFrame() || !owner->contentFrame()->isLocalFrame()) |
| 1493 break; | 1493 break; |
| 1494 | 1494 |
| 1495 LocalFrame* oldHoverFrame = toLocalFrame(owner->contentFrame()); | 1495 LocalFrame* oldHoverFrame = toLocalFrame(owner->contentFrame()); |
| 1496 Document* doc = oldHoverFrame->document(); | 1496 Document* doc = oldHoverFrame->document(); |
| 1497 if (!doc) | 1497 if (!doc) |
| 1498 break; | 1498 break; |
| 1499 | 1499 |
| 1500 oldHoverNodeInCurDoc = doc->hoverNode(); | 1500 oldHoverElementInCurDoc = doc->hoverElement(); |
| 1501 // If the old hovered frame is different from the new hovered frame. | 1501 // If the old hovered frame is different from the new hovered frame. |
| 1502 // we should clear the old hovered node from the old hovered frame. | 1502 // we should clear the old hovered element from the old hovered frame. |
| 1503 if (newHoverFrame != oldHoverFrame) | 1503 if (newHoverFrame != oldHoverFrame) |
| 1504 doc->updateHoverActiveState(request, nullptr); | 1504 doc->updateHoverActiveState(request, nullptr); |
| 1505 } | 1505 } |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 // Recursively set the new active/hover states on every frame in the chain of | 1508 // Recursively set the new active/hover states on every frame in the chain of |
| 1509 // innerElement. | 1509 // innerElement. |
| 1510 m_frame->document()->updateHoverActiveState(request, innerElement); | 1510 m_frame->document()->updateHoverActiveState(request, innerElement); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 MouseEventWithHitTestResults& mev, | 2083 MouseEventWithHitTestResults& mev, |
| 2084 LocalFrame* subframe) { | 2084 LocalFrame* subframe) { |
| 2085 WebInputEventResult result = | 2085 WebInputEventResult result = |
| 2086 subframe->eventHandler().handleMouseReleaseEvent(mev.event()); | 2086 subframe->eventHandler().handleMouseReleaseEvent(mev.event()); |
| 2087 if (result != WebInputEventResult::NotHandled) | 2087 if (result != WebInputEventResult::NotHandled) |
| 2088 return result; | 2088 return result; |
| 2089 return WebInputEventResult::HandledSystem; | 2089 return WebInputEventResult::HandledSystem; |
| 2090 } | 2090 } |
| 2091 | 2091 |
| 2092 } // namespace blink | 2092 } // namespace blink |
| OLD | NEW |