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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 #include "platform/weborigin/SecurityOrigin.h" | 191 #include "platform/weborigin/SecurityOrigin.h" |
192 #include "public/platform/Platform.h" | 192 #include "public/platform/Platform.h" |
193 #include "wtf/CurrentTime.h" | 193 #include "wtf/CurrentTime.h" |
194 #include "wtf/HashFunctions.h" | 194 #include "wtf/HashFunctions.h" |
195 #include "wtf/MainThread.h" | 195 #include "wtf/MainThread.h" |
196 #include "wtf/StdLibExtras.h" | 196 #include "wtf/StdLibExtras.h" |
197 #include "wtf/TemporaryChange.h" | 197 #include "wtf/TemporaryChange.h" |
198 #include "wtf/text/StringBuffer.h" | 198 #include "wtf/text/StringBuffer.h" |
199 #include "wtf/text/TextEncodingRegistry.h" | 199 #include "wtf/text/TextEncodingRegistry.h" |
200 | 200 |
201 using namespace std; | |
202 using namespace WTF; | 201 using namespace WTF; |
203 using namespace Unicode; | 202 using namespace Unicode; |
204 | 203 |
205 namespace WebCore { | 204 namespace WebCore { |
206 | 205 |
207 using namespace HTMLNames; | 206 using namespace HTMLNames; |
208 | 207 |
209 static const unsigned cMaxWriteRecursionDepth = 21; | 208 static const unsigned cMaxWriteRecursionDepth = 21; |
210 | 209 |
211 // This amount of time must have elapsed before we will even consider scheduling
a layout without a delay. | 210 // This amount of time must have elapsed before we will even consider scheduling
a layout without a delay. |
(...skipping 4882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5094 } | 5093 } |
5095 | 5094 |
5096 void Document::addToTopLayer(Element* element, const Element* before) | 5095 void Document::addToTopLayer(Element* element, const Element* before) |
5097 { | 5096 { |
5098 if (element->isInTopLayer()) | 5097 if (element->isInTopLayer()) |
5099 return; | 5098 return; |
5100 | 5099 |
5101 ASSERT(!m_topLayerElements.contains(element)); | 5100 ASSERT(!m_topLayerElements.contains(element)); |
5102 ASSERT(!before || m_topLayerElements.contains(before)); | 5101 ASSERT(!before || m_topLayerElements.contains(before)); |
5103 if (before) { | 5102 if (before) { |
5104 size_t beforePosition = m_topLayerElements.find(before); | 5103 std::size_t beforePosition = m_topLayerElements.find(before); |
5105 m_topLayerElements.insert(beforePosition, element); | 5104 m_topLayerElements.insert(beforePosition, element); |
5106 } else { | 5105 } else { |
5107 m_topLayerElements.append(element); | 5106 m_topLayerElements.append(element); |
5108 } | 5107 } |
5109 element->setIsInTopLayer(true); | 5108 element->setIsInTopLayer(true); |
5110 } | 5109 } |
5111 | 5110 |
5112 void Document::removeFromTopLayer(Element* element) | 5111 void Document::removeFromTopLayer(Element* element) |
5113 { | 5112 { |
5114 if (!element->isInTopLayer()) | 5113 if (!element->isInTopLayer()) |
5115 return; | 5114 return; |
5116 size_t position = m_topLayerElements.find(element); | 5115 std::size_t position = m_topLayerElements.find(element); |
5117 ASSERT(position != kNotFound); | 5116 ASSERT(position != kNotFound); |
5118 m_topLayerElements.remove(position); | 5117 m_topLayerElements.remove(position); |
5119 element->setIsInTopLayer(false); | 5118 element->setIsInTopLayer(false); |
5120 } | 5119 } |
5121 | 5120 |
5122 HTMLDialogElement* Document::activeModalDialog() const | 5121 HTMLDialogElement* Document::activeModalDialog() const |
5123 { | 5122 { |
5124 if (m_topLayerElements.isEmpty()) | 5123 if (m_topLayerElements.isEmpty()) |
5125 return 0; | 5124 return 0; |
5126 return toHTMLDialogElement(m_topLayerElements.last().get()); | 5125 return toHTMLDialogElement(m_topLayerElements.last().get()); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5373 node = doc->documentElement(); | 5372 node = doc->documentElement(); |
5374 return node; | 5373 return node; |
5375 } | 5374 } |
5376 | 5375 |
5377 void Document::adjustFloatQuadsForScrollAndAbsoluteZoom(Vector<FloatQuad>& quads
, RenderObject& renderer) | 5376 void Document::adjustFloatQuadsForScrollAndAbsoluteZoom(Vector<FloatQuad>& quads
, RenderObject& renderer) |
5378 { | 5377 { |
5379 if (!view()) | 5378 if (!view()) |
5380 return; | 5379 return; |
5381 | 5380 |
5382 LayoutRect visibleContentRect = view()->visibleContentRect(); | 5381 LayoutRect visibleContentRect = view()->visibleContentRect(); |
5383 for (size_t i = 0; i < quads.size(); ++i) { | 5382 for (std::size_t i = 0; i < quads.size(); ++i) { |
5384 quads[i].move(-FloatSize(visibleContentRect.x().toFloat(), visibleConten
tRect.y().toFloat())); | 5383 quads[i].move(-FloatSize(visibleContentRect.x().toFloat(), visibleConten
tRect.y().toFloat())); |
5385 adjustFloatQuadForAbsoluteZoom(quads[i], renderer); | 5384 adjustFloatQuadForAbsoluteZoom(quads[i], renderer); |
5386 } | 5385 } |
5387 } | 5386 } |
5388 | 5387 |
5389 void Document::adjustFloatRectForScrollAndAbsoluteZoom(FloatRect& rect, RenderOb
ject& renderer) | 5388 void Document::adjustFloatRectForScrollAndAbsoluteZoom(FloatRect& rect, RenderOb
ject& renderer) |
5390 { | 5389 { |
5391 if (!view()) | 5390 if (!view()) |
5392 return; | 5391 return; |
5393 | 5392 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5534 bool ancestorHasCapturingMouseleaveListener = false; | 5533 bool ancestorHasCapturingMouseleaveListener = false; |
5535 if (event && newHoverNode != oldHoverNode.get()) { | 5534 if (event && newHoverNode != oldHoverNode.get()) { |
5536 for (Node* node = oldHoverNode.get(); node; node = node->parentOrShadowH
ostNode()) { | 5535 for (Node* node = oldHoverNode.get(); node; node = node->parentOrShadowH
ostNode()) { |
5537 if (node->hasCapturingEventListeners(EventTypeNames::mouseleave)) { | 5536 if (node->hasCapturingEventListeners(EventTypeNames::mouseleave)) { |
5538 ancestorHasCapturingMouseleaveListener = true; | 5537 ancestorHasCapturingMouseleaveListener = true; |
5539 break; | 5538 break; |
5540 } | 5539 } |
5541 } | 5540 } |
5542 } | 5541 } |
5543 | 5542 |
5544 size_t removeCount = nodesToRemoveFromChain.size(); | 5543 std::size_t removeCount = nodesToRemoveFromChain.size(); |
5545 for (size_t i = 0; i < removeCount; ++i) { | 5544 for (std::size_t i = 0; i < removeCount; ++i) { |
5546 nodesToRemoveFromChain[i]->setHovered(false); | 5545 nodesToRemoveFromChain[i]->setHovered(false); |
5547 if (event && (ancestorHasCapturingMouseleaveListener || nodesToRemoveFro
mChain[i]->hasEventListeners(EventTypeNames::mouseleave))) | 5546 if (event && (ancestorHasCapturingMouseleaveListener || nodesToRemoveFro
mChain[i]->hasEventListeners(EventTypeNames::mouseleave))) |
5548 nodesToRemoveFromChain[i]->dispatchMouseEvent(*event, EventTypeNames
::mouseleave, 0, newHoverNode); | 5547 nodesToRemoveFromChain[i]->dispatchMouseEvent(*event, EventTypeNames
::mouseleave, 0, newHoverNode); |
5549 } | 5548 } |
5550 | 5549 |
5551 bool ancestorHasCapturingMouseenterListener = false; | 5550 bool ancestorHasCapturingMouseenterListener = false; |
5552 if (event && newHoverNode != oldHoverNode.get()) { | 5551 if (event && newHoverNode != oldHoverNode.get()) { |
5553 for (Node* node = newHoverNode; node; node = node->parentOrShadowHostNod
e()) { | 5552 for (Node* node = newHoverNode; node; node = node->parentOrShadowHostNod
e()) { |
5554 if (node->hasCapturingEventListeners(EventTypeNames::mouseenter)) { | 5553 if (node->hasCapturingEventListeners(EventTypeNames::mouseenter)) { |
5555 ancestorHasCapturingMouseenterListener = true; | 5554 ancestorHasCapturingMouseenterListener = true; |
5556 break; | 5555 break; |
5557 } | 5556 } |
5558 } | 5557 } |
5559 } | 5558 } |
5560 | 5559 |
5561 bool sawCommonAncestor = false; | 5560 bool sawCommonAncestor = false; |
5562 size_t addCount = nodesToAddToChain.size(); | 5561 std::size_t addCount = nodesToAddToChain.size(); |
5563 for (size_t i = 0; i < addCount; ++i) { | 5562 for (std::size_t i = 0; i < addCount; ++i) { |
5564 // Elements past the common ancestor do not change hover state, but migh
t change active state. | 5563 // Elements past the common ancestor do not change hover state, but migh
t change active state. |
5565 if (ancestorNode && nodesToAddToChain[i] == ancestorNode) | 5564 if (ancestorNode && nodesToAddToChain[i] == ancestorNode) |
5566 sawCommonAncestor = true; | 5565 sawCommonAncestor = true; |
5567 if (allowActiveChanges) | 5566 if (allowActiveChanges) |
5568 nodesToAddToChain[i]->setActive(true); | 5567 nodesToAddToChain[i]->setActive(true); |
5569 if (!sawCommonAncestor) { | 5568 if (!sawCommonAncestor) { |
5570 nodesToAddToChain[i]->setHovered(true); | 5569 nodesToAddToChain[i]->setHovered(true); |
5571 if (event && (ancestorHasCapturingMouseenterListener || nodesToAddTo
Chain[i]->hasEventListeners(EventTypeNames::mouseenter))) | 5570 if (event && (ancestorHasCapturingMouseenterListener || nodesToAddTo
Chain[i]->hasEventListeners(EventTypeNames::mouseenter))) |
5572 nodesToAddToChain[i]->dispatchMouseEvent(*event, EventTypeNames:
:mouseenter, 0, oldHoverNode.get()); | 5571 nodesToAddToChain[i]->dispatchMouseEvent(*event, EventTypeNames:
:mouseenter, 0, oldHoverNode.get()); |
5573 } | 5572 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5838 visitor->trace(m_compositorPendingAnimations); | 5837 visitor->trace(m_compositorPendingAnimations); |
5839 visitor->trace(m_contextDocument); | 5838 visitor->trace(m_contextDocument); |
5840 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); | 5839 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); |
5841 DocumentSupplementable::trace(visitor); | 5840 DocumentSupplementable::trace(visitor); |
5842 TreeScope::trace(visitor); | 5841 TreeScope::trace(visitor); |
5843 ContainerNode::trace(visitor); | 5842 ContainerNode::trace(visitor); |
5844 ExecutionContext::trace(visitor); | 5843 ExecutionContext::trace(visitor); |
5845 } | 5844 } |
5846 | 5845 |
5847 } // namespace WebCore | 5846 } // namespace WebCore |
OLD | NEW |