| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   309     //     The origin of the Document is the origin it was assigned when its bro
      wsing context was created. |   309     //     The origin of the Document is the origin it was assigned when its bro
      wsing context was created. | 
|   310     // |   310     // | 
|   311     // Note: We generalize this to all "blank" URLs and invalid URLs because we |   311     // Note: We generalize this to all "blank" URLs and invalid URLs because we | 
|   312     // treat all of these URLs as about:blank. |   312     // treat all of these URLs as about:blank. | 
|   313     // |   313     // | 
|   314     return url.isEmpty() || url.protocolIsAbout(); |   314     return url.isEmpty() || url.protocolIsAbout(); | 
|   315 } |   315 } | 
|   316  |   316  | 
|   317 static Widget* widgetForElement(const Element& focusedElement) |   317 static Widget* widgetForElement(const Element& focusedElement) | 
|   318 { |   318 { | 
|   319     LayoutObject* renderer = focusedElement.renderer(); |   319     LayoutObject* renderer = focusedElement.layoutObject(); | 
|   320     if (!renderer || !renderer->isLayoutPart()) |   320     if (!renderer || !renderer->isLayoutPart()) | 
|   321         return 0; |   321         return 0; | 
|   322     return toLayoutPart(renderer)->widget(); |   322     return toLayoutPart(renderer)->widget(); | 
|   323 } |   323 } | 
|   324  |   324  | 
|   325 static bool acceptsEditingFocus(const Element& element) |   325 static bool acceptsEditingFocus(const Element& element) | 
|   326 { |   326 { | 
|   327     ASSERT(element.hasEditableStyle()); |   327     ASSERT(element.hasEditableStyle()); | 
|   328  |   328  | 
|   329     return element.document().frame() && element.rootEditableElement(); |   329     return element.document().frame() && element.rootEditableElement(); | 
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1736     // hits a null-dereference due to security code always assuming the document
       has a SecurityOrigin. |  1736     // hits a null-dereference due to security code always assuming the document
       has a SecurityOrigin. | 
|  1737  |  1737  | 
|  1738     if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) |  1738     if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) | 
|  1739         styleEngine().setUsesRemUnit(true); |  1739         styleEngine().setUsesRemUnit(true); | 
|  1740  |  1740  | 
|  1741     updateStyle(change); |  1741     updateStyle(change); | 
|  1742  |  1742  | 
|  1743     // As a result of the style recalculation, the currently hovered element mig
      ht have been |  1743     // As a result of the style recalculation, the currently hovered element mig
      ht have been | 
|  1744     // detached (for example, by setting display:none in the :hover style), sche
      dule another mouseMove event |  1744     // detached (for example, by setting display:none in the :hover style), sche
      dule another mouseMove event | 
|  1745     // to check if any other elements ended up under the mouse pointer due to re
      -layout. |  1745     // to check if any other elements ended up under the mouse pointer due to re
      -layout. | 
|  1746     if (hoverNode() && !hoverNode()->renderer() && frame()) |  1746     if (hoverNode() && !hoverNode()->layoutObject() && frame()) | 
|  1747         frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); |  1747         frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); | 
|  1748  |  1748  | 
|  1749     if (m_focusedElement && !m_focusedElement->isFocusable()) |  1749     if (m_focusedElement && !m_focusedElement->isFocusable()) | 
|  1750         clearFocusedElementSoon(); |  1750         clearFocusedElementSoon(); | 
|  1751  |  1751  | 
|  1752     ASSERT(!m_timeline->hasOutdatedAnimationPlayer()); |  1752     ASSERT(!m_timeline->hasOutdatedAnimationPlayer()); | 
|  1753  |  1753  | 
|  1754     TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalculat
      eStyles", "elementCount", m_styleRecalcElementCounter); |  1754     TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalculat
      eStyles", "elementCount", m_styleRecalcElementCounter); | 
|  1755     TRACE_EVENT_END1("blink", "Document::updateRenderTree", "elementCount", m_st
      yleRecalcElementCounter); |  1755     TRACE_EVENT_END1("blink", "Document::updateRenderTree", "elementCount", m_st
      yleRecalcElementCounter); | 
|  1756     InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
      unter); |  1756     InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCo
      unter); | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1897  |  1897  | 
|  1898     if (styleEngine().hasPendingSheets()) { |  1898     if (styleEngine().hasPendingSheets()) { | 
|  1899         // FIXME: We are willing to attempt to suppress painting with outdated s
      tyle info only once. |  1899         // FIXME: We are willing to attempt to suppress painting with outdated s
      tyle info only once. | 
|  1900         // Our assumption is that it would be dangerous to try to stop it a seco
      nd time, after page |  1900         // Our assumption is that it would be dangerous to try to stop it a seco
      nd time, after page | 
|  1901         // content has already been loaded and displayed with accurate style inf
      ormation. (Our |  1901         // content has already been loaded and displayed with accurate style inf
      ormation. (Our | 
|  1902         // suppression involves blanking the whole page at the moment. If it wer
      e more refined, we |  1902         // suppression involves blanking the whole page at the moment. If it wer
      e more refined, we | 
|  1903         // might be able to do something better.) It's worth noting though that 
      this entire method |  1903         // might be able to do something better.) It's worth noting though that 
      this entire method | 
|  1904         // is a hack, since what we really want to do is suspend JS instead of d
      oing a layout with |  1904         // is a hack, since what we really want to do is suspend JS instead of d
      oing a layout with | 
|  1905         // inaccurate information. |  1905         // inaccurate information. | 
|  1906         HTMLElement* bodyElement = body(); |  1906         HTMLElement* bodyElement = body(); | 
|  1907         if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == N
      oLayoutWithPendingSheets) { |  1907         if (bodyElement && !bodyElement->layoutObject() && m_pendingSheetLayout 
      == NoLayoutWithPendingSheets) { | 
|  1908             m_pendingSheetLayout = DidLayoutWithPendingSheets; |  1908             m_pendingSheetLayout = DidLayoutWithPendingSheets; | 
|  1909             styleResolverChanged(); |  1909             styleResolverChanged(); | 
|  1910         } else if (m_hasNodesWithPlaceholderStyle) { |  1910         } else if (m_hasNodesWithPlaceholderStyle) { | 
|  1911             // If new nodes have been added or style recalc has been done with s
      tyle sheets still |  1911             // If new nodes have been added or style recalc has been done with s
      tyle sheets still | 
|  1912             // pending, some nodes may not have had their real style calculated 
      yet. Normally this |  1912             // pending, some nodes may not have had their real style calculated 
      yet. Normally this | 
|  1913             // gets cleaned when style sheets arrive but here we need up-to-date
       style immediately. |  1913             // gets cleaned when style sheets arrive but here we need up-to-date
       style immediately. | 
|  1914             updateRenderTree(Force); |  1914             updateRenderTree(Force); | 
|  1915         } |  1915         } | 
|  1916     } |  1916     } | 
|  1917  |  1917  | 
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2488     if (frame()->navigationScheduler().locationChangePending() && elapsedTime() 
      < cLayoutScheduleThreshold) { |  2488     if (frame()->navigationScheduler().locationChangePending() && elapsedTime() 
      < cLayoutScheduleThreshold) { | 
|  2489         // Just bail out. Before or during the onload we were shifted to another
       page. |  2489         // Just bail out. Before or during the onload we were shifted to another
       page. | 
|  2490         // The old i-Bench suite does this. When this happens don't bother paint
      ing or laying out. |  2490         // The old i-Bench suite does this. When this happens don't bother paint
      ing or laying out. | 
|  2491         m_loadEventProgress = LoadEventCompleted; |  2491         m_loadEventProgress = LoadEventCompleted; | 
|  2492         return; |  2492         return; | 
|  2493     } |  2493     } | 
|  2494  |  2494  | 
|  2495     // We used to force a synchronous display and flush here.  This really isn't |  2495     // We used to force a synchronous display and flush here.  This really isn't | 
|  2496     // necessary and can in fact be actively harmful if pages are loading at a r
      ate of > 60fps |  2496     // necessary and can in fact be actively harmful if pages are loading at a r
      ate of > 60fps | 
|  2497     // (if your platform is syncing flushes and limiting them to 60fps). |  2497     // (if your platform is syncing flushes and limiting them to 60fps). | 
|  2498     if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende
      rer()->needsLayout())) { |  2498     if (!ownerElement() || (ownerElement()->layoutObject() && !ownerElement()->l
      ayoutObject()->needsLayout())) { | 
|  2499         updateRenderTreeIfNeeded(); |  2499         updateRenderTreeIfNeeded(); | 
|  2500  |  2500  | 
|  2501         // Always do a layout after loading if needed. |  2501         // Always do a layout after loading if needed. | 
|  2502         if (view() && layoutView() && (!layoutView()->firstChild() || layoutView
      ()->needsLayout())) |  2502         if (view() && layoutView() && (!layoutView()->firstChild() || layoutView
      ()->needsLayout())) | 
|  2503             view()->layout(); |  2503             view()->layout(); | 
|  2504     } |  2504     } | 
|  2505  |  2505  | 
|  2506     m_loadEventProgress = LoadEventCompleted; |  2506     m_loadEventProgress = LoadEventCompleted; | 
|  2507  |  2507  | 
|  2508     if (frame() && layoutView() && settings()->accessibilityEnabled()) { |  2508     if (frame() && layoutView() && settings()->accessibilityEnabled()) { | 
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3342 { |  3342 { | 
|  3343     ASSERT(node); |  3343     ASSERT(node); | 
|  3344     if (!m_hoverNode) |  3344     if (!m_hoverNode) | 
|  3345         return; |  3345         return; | 
|  3346  |  3346  | 
|  3347     m_hoverNode->updateDistribution(); |  3347     m_hoverNode->updateDistribution(); | 
|  3348     if (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != NodeRender
      ingTraversal::parent(*m_hoverNode))) |  3348     if (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != NodeRender
      ingTraversal::parent(*m_hoverNode))) | 
|  3349         return; |  3349         return; | 
|  3350  |  3350  | 
|  3351     m_hoverNode = NodeRenderingTraversal::parent(*node); |  3351     m_hoverNode = NodeRenderingTraversal::parent(*node); | 
|  3352     while (m_hoverNode && !m_hoverNode->renderer()) |  3352     while (m_hoverNode && !m_hoverNode->layoutObject()) | 
|  3353         m_hoverNode = NodeRenderingTraversal::parent(*m_hoverNode); |  3353         m_hoverNode = NodeRenderingTraversal::parent(*m_hoverNode); | 
|  3354  |  3354  | 
|  3355     // If the mouse cursor is not visible, do not clear existing |  3355     // If the mouse cursor is not visible, do not clear existing | 
|  3356     // hover effects on the ancestors of |node| and do not invoke |  3356     // hover effects on the ancestors of |node| and do not invoke | 
|  3357     // new hover effects on any other element. |  3357     // new hover effects on any other element. | 
|  3358     if (!page()->isCursorVisible()) |  3358     if (!page()->isCursorVisible()) | 
|  3359         return; |  3359         return; | 
|  3360  |  3360  | 
|  3361     if (frame()) |  3361     if (frame()) | 
|  3362         frame()->eventHandler().scheduleHoverStateUpdate(); |  3362         frame()->eventHandler().scheduleHoverStateUpdate(); | 
|  3363 } |  3363 } | 
|  3364  |  3364  | 
|  3365 void Document::activeChainNodeDetached(Node* node) |  3365 void Document::activeChainNodeDetached(Node* node) | 
|  3366 { |  3366 { | 
|  3367     if (!m_activeHoverElement) |  3367     if (!m_activeHoverElement) | 
|  3368         return; |  3368         return; | 
|  3369  |  3369  | 
|  3370     if (node != m_activeHoverElement) |  3370     if (node != m_activeHoverElement) | 
|  3371         return; |  3371         return; | 
|  3372  |  3372  | 
|  3373     Node* activeNode = NodeRenderingTraversal::parent(*node); |  3373     Node* activeNode = NodeRenderingTraversal::parent(*node); | 
|  3374     while (activeNode && activeNode->isElementNode() && !activeNode->renderer()) |  3374     while (activeNode && activeNode->isElementNode() && !activeNode->layoutObjec
      t()) | 
|  3375         activeNode = NodeRenderingTraversal::parent(*activeNode); |  3375         activeNode = NodeRenderingTraversal::parent(*activeNode); | 
|  3376  |  3376  | 
|  3377     m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement
      (activeNode) : 0; |  3377     m_activeHoverElement = activeNode && activeNode->isElementNode() ? toElement
      (activeNode) : 0; | 
|  3378 } |  3378 } | 
|  3379  |  3379  | 
|  3380 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const |  3380 const Vector<AnnotatedRegionValue>& Document::annotatedRegions() const | 
|  3381 { |  3381 { | 
|  3382     return m_annotatedRegions; |  3382     return m_annotatedRegions; | 
|  3383 } |  3383 } | 
|  3384  |  3384  | 
| (...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5248     // If the mouse is down and if this is a mouse move event, we want to restri
      ct changes in |  5248     // If the mouse is down and if this is a mouse move event, we want to restri
      ct changes in | 
|  5249     // :hover/:active to only apply to elements that are in the :active chain th
      at we froze |  5249     // :hover/:active to only apply to elements that are in the :active chain th
      at we froze | 
|  5250     // at the time the mouse went down. |  5250     // at the time the mouse went down. | 
|  5251     bool mustBeInActiveChain = request.active() && request.move(); |  5251     bool mustBeInActiveChain = request.active() && request.move(); | 
|  5252  |  5252  | 
|  5253     RefPtrWillBeRawPtr<Node> oldHoverNode = hoverNode(); |  5253     RefPtrWillBeRawPtr<Node> oldHoverNode = hoverNode(); | 
|  5254  |  5254  | 
|  5255     // Check to see if the hovered node has changed. |  5255     // Check to see if the hovered node has changed. | 
|  5256     // If it hasn't, we do not need to do anything. |  5256     // If it hasn't, we do not need to do anything. | 
|  5257     Node* newHoverNode = innerElementInDocument; |  5257     Node* newHoverNode = innerElementInDocument; | 
|  5258     while (newHoverNode && !newHoverNode->renderer()) |  5258     while (newHoverNode && !newHoverNode->layoutObject()) | 
|  5259         newHoverNode = newHoverNode->parentOrShadowHostNode(); |  5259         newHoverNode = newHoverNode->parentOrShadowHostNode(); | 
|  5260  |  5260  | 
|  5261     // Update our current hover node. |  5261     // Update our current hover node. | 
|  5262     setHoverNode(newHoverNode); |  5262     setHoverNode(newHoverNode); | 
|  5263  |  5263  | 
|  5264     // We have two different objects. Fetch their renderers. |  5264     // We have two different objects. Fetch their renderers. | 
|  5265     LayoutObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; |  5265     LayoutObject* oldHoverObj = oldHoverNode ? oldHoverNode->layoutObject() : 0; | 
|  5266     LayoutObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; |  5266     LayoutObject* newHoverObj = newHoverNode ? newHoverNode->layoutObject() : 0; | 
|  5267  |  5267  | 
|  5268     // Locate the common ancestor render object for the two renderers. |  5268     // Locate the common ancestor render object for the two renderers. | 
|  5269     LayoutObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
      ); |  5269     LayoutObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
      ); | 
|  5270     RefPtrWillBeRawPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0); |  5270     RefPtrWillBeRawPtr<Node> ancestorNode(ancestor ? ancestor->node() : 0); | 
|  5271  |  5271  | 
|  5272     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToRemoveFromChain; |  5272     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToRemoveFromChain; | 
|  5273     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToAddToChain; |  5273     WillBeHeapVector<RefPtrWillBeMember<Node>, 32> nodesToAddToChain; | 
|  5274  |  5274  | 
|  5275     if (oldHoverObj != newHoverObj) { |  5275     if (oldHoverObj != newHoverObj) { | 
|  5276         // If the old hovered node is not nil but it's renderer is, it was proba
      bly detached as part of the :hover style |  5276         // If the old hovered node is not nil but it's renderer is, it was proba
      bly detached as part of the :hover style | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5723 #ifndef NDEBUG |  5723 #ifndef NDEBUG | 
|  5724 using namespace blink; |  5724 using namespace blink; | 
|  5725 void showLiveDocumentInstances() |  5725 void showLiveDocumentInstances() | 
|  5726 { |  5726 { | 
|  5727     WeakDocumentSet& set = liveDocumentSet(); |  5727     WeakDocumentSet& set = liveDocumentSet(); | 
|  5728     fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |  5728     fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 
|  5729     for (Document* document : set) |  5729     for (Document* document : set) | 
|  5730         fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
      ing().utf8().data()); |  5730         fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str
      ing().utf8().data()); | 
|  5731 } |  5731 } | 
|  5732 #endif |  5732 #endif | 
| OLD | NEW |