OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3418 } | 3418 } |
3419 } | 3419 } |
3420 | 3420 |
3421 void Document::styleResolverMayHaveChanged() | 3421 void Document::styleResolverMayHaveChanged() |
3422 { | 3422 { |
3423 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal yzedStyleUpdate); | 3423 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal yzedStyleUpdate); |
3424 } | 3424 } |
3425 | 3425 |
3426 void Document::setHoverNode(PassRefPtrWillBeRawPtr<Node> newHoverNode) | 3426 void Document::setHoverNode(PassRefPtrWillBeRawPtr<Node> newHoverNode) |
3427 { | 3427 { |
3428 if (!newHoverNode) { | |
3429 m_hoverNode.clear(); | |
Rick Byers
2014/11/17 22:00:10
why is this change necessary? Doesn't it already
| |
3430 return; | |
3431 } | |
3428 m_hoverNode = newHoverNode; | 3432 m_hoverNode = newHoverNode; |
3429 } | 3433 } |
3430 | 3434 |
3431 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement) | 3435 void Document::setActiveHoverElement(PassRefPtrWillBeRawPtr<Element> newActiveEl ement) |
3432 { | 3436 { |
3433 if (!newActiveElement) { | 3437 if (!newActiveElement) { |
3434 m_activeHoverElement.clear(); | 3438 m_activeHoverElement.clear(); |
3435 return; | 3439 return; |
3436 } | 3440 } |
3437 | 3441 |
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5417 | 5421 |
5418 } | 5422 } |
5419 | 5423 |
5420 // The old hover path only needs to be cleared up to (and not including) the common ancestor; | 5424 // The old hover path only needs to be cleared up to (and not including) the common ancestor; |
5421 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { | 5425 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = curr->hoverAncestor()) { |
5422 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) | 5426 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) |
5423 nodesToRemoveFromChain.append(curr->node()); | 5427 nodesToRemoveFromChain.append(curr->node()); |
5424 } | 5428 } |
5425 } | 5429 } |
5426 | 5430 |
5427 // Now set the hover state for our new object up to the root. | 5431 if ((settings() && settings()->viewportEnabled()) |
Rick Byers
2014/11/17 22:00:10
The logic to decide when to apply this policy belo
| |
5428 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { | 5432 && oldHoverObj == newHoverObj && request.touchEvent() && !request.active () && !request.hover()) { |
5429 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no de()->inActiveChain())) | 5433 // clear the :hover style after Tap, when meta viewport is set |
5430 nodesToAddToChain.append(curr->node()); | 5434 for (RenderObject* curr = oldHoverObj; curr; curr = curr->hoverAncestor( )) { |
Rick Byers
2014/11/17 22:00:10
please don't copy/paste code from above. We shoul
| |
5435 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) { | |
5436 nodesToRemoveFromChain.append(curr->node()); | |
5437 } | |
5438 } | |
5439 setHoverNode(nullptr); | |
5440 } else { | |
5441 // Now set the hover state for our new object up to the root. | |
5442 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor( )) { | |
5443 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr ->node()->inActiveChain())) | |
5444 nodesToAddToChain.append(curr->node()); | |
5445 } | |
5431 } | 5446 } |
5432 | 5447 |
5433 // mouseenter and mouseleave events do not bubble, so they are dispatched if f there is a capturing | 5448 // mouseenter and mouseleave events do not bubble, so they are dispatched if f there is a capturing |
5434 // event handler on an ancestor or a normal event handler on the element its elf. This special | 5449 // event handler on an ancestor or a normal event handler on the element its elf. This special |
5435 // handling is necessary to avoid O(n^2) capturing event handler checks. We' ll check the previously | 5450 // handling is necessary to avoid O(n^2) capturing event handler checks. We' ll check the previously |
5436 // hovered node's ancestor tree for 'mouseleave' handlers here, then check t he newly hovered node's | 5451 // hovered node's ancestor tree for 'mouseleave' handlers here, then check t he newly hovered node's |
5437 // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave ' events (as the handler | 5452 // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave ' events (as the handler |
5438 // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that might be). | 5453 // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that might be). |
5439 bool ancestorHasCapturingMouseleaveListener = false; | 5454 bool ancestorHasCapturingMouseleaveListener = false; |
5440 if (event && newHoverNode != oldHoverNode.get()) { | 5455 if (event && newHoverNode != oldHoverNode.get()) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5848 #ifndef NDEBUG | 5863 #ifndef NDEBUG |
5849 using namespace blink; | 5864 using namespace blink; |
5850 void showLiveDocumentInstances() | 5865 void showLiveDocumentInstances() |
5851 { | 5866 { |
5852 WeakDocumentSet& set = liveDocumentSet(); | 5867 WeakDocumentSet& set = liveDocumentSet(); |
5853 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5868 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5854 for (Document* document : set) | 5869 for (Document* document : set) |
5855 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5870 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
5856 } | 5871 } |
5857 #endif | 5872 #endif |
OLD | NEW |