Chromium Code Reviews| 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 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1464 // work that cleans the hover state. Because the hover state for the main | 1464 // work that cleans the hover state. Because the hover state for the main |
| 1465 // frame is updated by calling Document::updateHoverActiveState | 1465 // 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 node from the old hovered frame. |
|
Manuel Rego
2017/04/05 15:16:13
Nit: Update the comment "the old hovered node".
rune
2017/04/05 19:43:27
Fixed another instance as well.
| |
| 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 |