| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 307     //     The origin of the Document is the origin it was assigned when its bro
      wsing context was created. | 307     //     The origin of the Document is the origin it was assigned when its bro
      wsing context was created. | 
| 308     // | 308     // | 
| 309     // Note: We generalize this to all "blank" URLs and invalid URLs because we | 309     // Note: We generalize this to all "blank" URLs and invalid URLs because we | 
| 310     // treat all of these URLs as about:blank. | 310     // treat all of these URLs as about:blank. | 
| 311     // | 311     // | 
| 312     return url.isEmpty() || url.protocolIsAbout(); | 312     return url.isEmpty() || url.protocolIsAbout(); | 
| 313 } | 313 } | 
| 314 | 314 | 
| 315 static Widget* widgetForElement(const Element& focusedElement) | 315 static Widget* widgetForElement(const Element& focusedElement) | 
| 316 { | 316 { | 
| 317     RenderObject* renderer = focusedElement.renderer(); | 317     LayoutObject* renderer = focusedElement.renderer(); | 
| 318     if (!renderer || !renderer->isRenderPart()) | 318     if (!renderer || !renderer->isRenderPart()) | 
| 319         return 0; | 319         return 0; | 
| 320     return toRenderPart(renderer)->widget(); | 320     return toRenderPart(renderer)->widget(); | 
| 321 } | 321 } | 
| 322 | 322 | 
| 323 static bool acceptsEditingFocus(const Element& element) | 323 static bool acceptsEditingFocus(const Element& element) | 
| 324 { | 324 { | 
| 325     ASSERT(element.hasEditableStyle()); | 325     ASSERT(element.hasEditableStyle()); | 
| 326 | 326 | 
| 327     return element.document().frame() && element.rootEditableElement(); | 327     return element.document().frame() && element.rootEditableElement(); | 
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1246         return 0; | 1246         return 0; | 
| 1247 | 1247 | 
| 1248     return TreeScope::elementFromPoint(x, y); | 1248     return TreeScope::elementFromPoint(x, y); | 
| 1249 } | 1249 } | 
| 1250 | 1250 | 
| 1251 PassRefPtrWillBeRawPtr<Range> Document::caretRangeFromPoint(int x, int y) | 1251 PassRefPtrWillBeRawPtr<Range> Document::caretRangeFromPoint(int x, int y) | 
| 1252 { | 1252 { | 
| 1253     if (!renderView()) | 1253     if (!renderView()) | 
| 1254         return nullptr; | 1254         return nullptr; | 
| 1255     HitTestResult result = hitTestInDocument(this, x, y); | 1255     HitTestResult result = hitTestInDocument(this, x, y); | 
| 1256     RenderObject* renderer = result.renderer(); | 1256     LayoutObject* renderer = result.renderer(); | 
| 1257     if (!renderer) | 1257     if (!renderer) | 
| 1258         return nullptr; | 1258         return nullptr; | 
| 1259 | 1259 | 
| 1260     Node* node = renderer->node(); | 1260     Node* node = renderer->node(); | 
| 1261     Node* shadowAncestorNode = ancestorInThisScope(node); | 1261     Node* shadowAncestorNode = ancestorInThisScope(node); | 
| 1262     if (shadowAncestorNode != node) { | 1262     if (shadowAncestorNode != node) { | 
| 1263         unsigned offset = shadowAncestorNode->nodeIndex(); | 1263         unsigned offset = shadowAncestorNode->nodeIndex(); | 
| 1264         ContainerNode* container = shadowAncestorNode->parentNode(); | 1264         ContainerNode* container = shadowAncestorNode->parentNode(); | 
| 1265         return Range::create(*this, container, offset, container, offset); | 1265         return Range::create(*this, container, offset, container, offset); | 
| 1266     } | 1266     } | 
| (...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5191         PluginDocument* pluginDocument = toPluginDocument(doc); | 5191         PluginDocument* pluginDocument = toPluginDocument(doc); | 
| 5192         node =  pluginDocument->pluginNode(); | 5192         node =  pluginDocument->pluginNode(); | 
| 5193     } | 5193     } | 
| 5194     if (!node && doc->isHTMLDocument()) | 5194     if (!node && doc->isHTMLDocument()) | 
| 5195         node = doc->body(); | 5195         node = doc->body(); | 
| 5196     if (!node) | 5196     if (!node) | 
| 5197         node = doc->documentElement(); | 5197         node = doc->documentElement(); | 
| 5198     return node; | 5198     return node; | 
| 5199 } | 5199 } | 
| 5200 | 5200 | 
| 5201 void Document::adjustFloatQuadsForScrollAndAbsoluteZoom(Vector<FloatQuad>& quads
      , RenderObject& renderer) | 5201 void Document::adjustFloatQuadsForScrollAndAbsoluteZoom(Vector<FloatQuad>& quads
      , LayoutObject& renderer) | 
| 5202 { | 5202 { | 
| 5203     if (!view()) | 5203     if (!view()) | 
| 5204         return; | 5204         return; | 
| 5205 | 5205 | 
| 5206     LayoutRect visibleContentRect = view()->visualViewportRect(); | 5206     LayoutRect visibleContentRect = view()->visualViewportRect(); | 
| 5207     for (size_t i = 0; i < quads.size(); ++i) { | 5207     for (size_t i = 0; i < quads.size(); ++i) { | 
| 5208         quads[i].move(-FloatSize(visibleContentRect.x().toFloat(), visibleConten
      tRect.y().toFloat())); | 5208         quads[i].move(-FloatSize(visibleContentRect.x().toFloat(), visibleConten
      tRect.y().toFloat())); | 
| 5209         adjustFloatQuadForAbsoluteZoom(quads[i], renderer); | 5209         adjustFloatQuadForAbsoluteZoom(quads[i], renderer); | 
| 5210     } | 5210     } | 
| 5211 } | 5211 } | 
| 5212 | 5212 | 
| 5213 void Document::adjustFloatRectForScrollAndAbsoluteZoom(FloatRect& rect, RenderOb
      ject& renderer) | 5213 void Document::adjustFloatRectForScrollAndAbsoluteZoom(FloatRect& rect, LayoutOb
      ject& renderer) | 
| 5214 { | 5214 { | 
| 5215     if (!view()) | 5215     if (!view()) | 
| 5216         return; | 5216         return; | 
| 5217 | 5217 | 
| 5218     LayoutRect visibleContentRect = view()->visualViewportRect(); | 5218     LayoutRect visibleContentRect = view()->visualViewportRect(); | 
| 5219     rect.move(-FloatSize(visibleContentRect.x().toFloat(), visibleContentRect.y(
      ).toFloat())); | 5219     rect.move(-FloatSize(visibleContentRect.x().toFloat(), visibleContentRect.y(
      ).toFloat())); | 
| 5220     adjustFloatRectForAbsoluteZoom(rect, renderer); | 5220     adjustFloatRectForAbsoluteZoom(rect, renderer); | 
| 5221 } | 5221 } | 
| 5222 | 5222 | 
| 5223 bool Document::hasActiveParser() | 5223 bool Document::hasActiveParser() | 
| 5224 { | 5224 { | 
| 5225     return m_activeParserCount || (m_parser && m_parser->processingData()); | 5225     return m_activeParserCount || (m_parser && m_parser->processingData()); | 
| 5226 } | 5226 } | 
| 5227 | 5227 | 
| 5228 void Document::setContextFeatures(ContextFeatures& features) | 5228 void Document::setContextFeatures(ContextFeatures& features) | 
| 5229 { | 5229 { | 
| 5230     m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features); | 5230     m_contextFeatures = PassRefPtrWillBeRawPtr<ContextFeatures>(features); | 
| 5231 } | 5231 } | 
| 5232 | 5232 | 
| 5233 static RenderObject* nearestCommonHoverAncestor(RenderObject* obj1, RenderObject
      * obj2) | 5233 static LayoutObject* nearestCommonHoverAncestor(LayoutObject* obj1, LayoutObject
      * obj2) | 
| 5234 { | 5234 { | 
| 5235     if (!obj1 || !obj2) | 5235     if (!obj1 || !obj2) | 
| 5236         return 0; | 5236         return 0; | 
| 5237 | 5237 | 
| 5238     for (RenderObject* currObj1 = obj1; currObj1; currObj1 = currObj1->hoverAnce
      stor()) { | 5238     for (LayoutObject* currObj1 = obj1; currObj1; currObj1 = currObj1->hoverAnce
      stor()) { | 
| 5239         for (RenderObject* currObj2 = obj2; currObj2; currObj2 = currObj2->hover
      Ancestor()) { | 5239         for (LayoutObject* currObj2 = obj2; currObj2; currObj2 = currObj2->hover
      Ancestor()) { | 
| 5240             if (currObj1 == currObj2) | 5240             if (currObj1 == currObj2) | 
| 5241                 return currObj1; | 5241                 return currObj1; | 
| 5242         } | 5242         } | 
| 5243     } | 5243     } | 
| 5244 | 5244 | 
| 5245     return 0; | 5245     return 0; | 
| 5246 } | 5246 } | 
| 5247 | 5247 | 
| 5248 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
      nerElement, const PlatformMouseEvent* event) | 5248 void Document::updateHoverActiveState(const HitTestRequest& request, Element* in
      nerElement, const PlatformMouseEvent* event) | 
| 5249 { | 5249 { | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5294     // Check to see if the hovered node has changed. | 5294     // Check to see if the hovered node has changed. | 
| 5295     // If it hasn't, we do not need to do anything. | 5295     // If it hasn't, we do not need to do anything. | 
| 5296     Node* newHoverNode = innerElementInDocument; | 5296     Node* newHoverNode = innerElementInDocument; | 
| 5297     while (newHoverNode && !newHoverNode->renderer()) | 5297     while (newHoverNode && !newHoverNode->renderer()) | 
| 5298         newHoverNode = newHoverNode->parentOrShadowHostNode(); | 5298         newHoverNode = newHoverNode->parentOrShadowHostNode(); | 
| 5299 | 5299 | 
| 5300     // Update our current hover node. | 5300     // Update our current hover node. | 
| 5301     setHoverNode(newHoverNode); | 5301     setHoverNode(newHoverNode); | 
| 5302 | 5302 | 
| 5303     // We have two different objects. Fetch their renderers. | 5303     // We have two different objects. Fetch their renderers. | 
| 5304     RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; | 5304     LayoutObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; | 
| 5305     RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; | 5305     LayoutObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; | 
| 5306 | 5306 | 
| 5307     // Locate the common ancestor render object for the two renderers. | 5307     // Locate the common ancestor render object for the two renderers. | 
| 5308     RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
      ); | 5308     LayoutObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
      ); | 
| 5309     RefPtrWillBeRawPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0); | 5309     RefPtrWillBeRawPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0); | 
| 5310 | 5310 | 
| 5311     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToRemoveFromChain; | 5311     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToRemoveFromChain; | 
| 5312     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToAddToChain; | 5312     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToAddToChain; | 
| 5313 | 5313 | 
| 5314     if (oldHoverObj != newHoverObj) { | 5314     if (oldHoverObj != newHoverObj) { | 
| 5315         // If the old hovered node is not nil but it's renderer is, it was proba
      bly detached as part of the :hover style | 5315         // If the old hovered node is not nil but it's renderer is, it was proba
      bly detached as part of the :hover style | 
| 5316         // (for instance by setting display:none in the :hover pseudo-class). In
       this case, the old hovered element (and its ancestors) | 5316         // (for instance by setting display:none in the :hover pseudo-class). In
       this case, the old hovered element (and its ancestors) | 
| 5317         // must be updated, to ensure it's normal style is re-applied. | 5317         // must be updated, to ensure it's normal style is re-applied. | 
| 5318         if (oldHoverNode && !oldHoverObj) { | 5318         if (oldHoverNode && !oldHoverObj) { | 
| 5319             for (Node* node = oldHoverNode.get(); node; node = node->parentNode(
      )) { | 5319             for (Node* node = oldHoverNode.get(); node; node = node->parentNode(
      )) { | 
| 5320                 if (!mustBeInActiveChain || (node->isElementNode() && toElement(
      node)->inActiveChain())) | 5320                 if (!mustBeInActiveChain || (node->isElementNode() && toElement(
      node)->inActiveChain())) | 
| 5321                     nodesToRemoveFromChain.append(node); | 5321                     nodesToRemoveFromChain.append(node); | 
| 5322             } | 5322             } | 
| 5323 | 5323 | 
| 5324         } | 5324         } | 
| 5325 | 5325 | 
| 5326         // The old hover path only needs to be cleared up to (and not including)
       the common ancestor; | 5326         // The old hover path only needs to be cleared up to (and not including)
       the common ancestor; | 
| 5327         for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr = 
      curr->hoverAncestor()) { | 5327         for (LayoutObject* curr = oldHoverObj; curr && curr != ancestor; curr = 
      curr->hoverAncestor()) { | 
| 5328             if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
      ->node()->inActiveChain())) | 5328             if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
      ->node()->inActiveChain())) | 
| 5329                 nodesToRemoveFromChain.append(curr->node()); | 5329                 nodesToRemoveFromChain.append(curr->node()); | 
| 5330         } | 5330         } | 
| 5331     } | 5331     } | 
| 5332 | 5332 | 
| 5333     // Now set the hover state for our new object up to the root. | 5333     // Now set the hover state for our new object up to the root. | 
| 5334     for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { | 5334     for (LayoutObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { | 
| 5335         if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
      de()->inActiveChain())) | 5335         if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
      de()->inActiveChain())) | 
| 5336             nodesToAddToChain.append(curr->node()); | 5336             nodesToAddToChain.append(curr->node()); | 
| 5337     } | 5337     } | 
| 5338 | 5338 | 
| 5339     // mouseenter and mouseleave events do not bubble, so they are dispatched if
      f there is a capturing | 5339     // mouseenter and mouseleave events do not bubble, so they are dispatched if
      f there is a capturing | 
| 5340     // event handler on an ancestor or a normal event handler on the element its
      elf. This special | 5340     // event handler on an ancestor or a normal event handler on the element its
      elf. This special | 
| 5341     // handling is necessary to avoid O(n^2) capturing event handler checks. We'
      ll check the previously | 5341     // handling is necessary to avoid O(n^2) capturing event handler checks. We'
      ll check the previously | 
| 5342     // hovered node's ancestor tree for 'mouseleave' handlers here, then check t
      he newly hovered node's | 5342     // hovered node's ancestor tree for 'mouseleave' handlers here, then check t
      he newly hovered node's | 
| 5343     // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave
      ' events (as the handler | 5343     // ancestor tree for 'mouseenter' handlers after dispatching the 'mouseleave
      ' events (as the handler | 
| 5344     // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that 
      might be). | 5344     // for 'mouseleave' might set a capturing 'mouseenter' handler, odd as that 
      might be). | 
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5762 #ifndef NDEBUG | 5762 #ifndef NDEBUG | 
| 5763 using namespace blink; | 5763 using namespace blink; | 
| 5764 void showLiveDocumentInstances() | 5764 void showLiveDocumentInstances() | 
| 5765 { | 5765 { | 
| 5766     WeakDocumentSet& set = liveDocumentSet(); | 5766     WeakDocumentSet& set = liveDocumentSet(); | 
| 5767     fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5767     fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 
| 5768     for (Document* document : set) | 5768     for (Document* document : set) | 
| 5769         fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
      ing().utf8().data()); | 5769         fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
      ing().utf8().data()); | 
| 5770 } | 5770 } | 
| 5771 #endif | 5771 #endif | 
| OLD | NEW | 
|---|