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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); | 1864 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); |
1865 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles)
); | 1865 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles)
); |
1866 m_styleSheetCollection->combineCSSFeatureFlags(); | 1866 m_styleSheetCollection->combineCSSFeatureFlags(); |
1867 } | 1867 } |
1868 | 1868 |
1869 void Document::clearStyleResolver() | 1869 void Document::clearStyleResolver() |
1870 { | 1870 { |
1871 m_styleResolver.clear(); | 1871 m_styleResolver.clear(); |
1872 } | 1872 } |
1873 | 1873 |
1874 void Document::attach() | 1874 void Document::attach(const AttachContext& context) |
1875 { | 1875 { |
1876 ASSERT(!attached()); | 1876 ASSERT(!attached()); |
1877 ASSERT(!m_axObjectCache || this != topDocument()); | 1877 ASSERT(!m_axObjectCache || this != topDocument()); |
1878 | 1878 |
1879 if (!m_renderArena) | 1879 if (!m_renderArena) |
1880 m_renderArena = RenderArena::create(); | 1880 m_renderArena = RenderArena::create(); |
1881 | 1881 |
1882 // Create the rendering tree | 1882 // Create the rendering tree |
1883 setRenderer(new (m_renderArena.get()) RenderView(this)); | 1883 setRenderer(new (m_renderArena.get()) RenderView(this)); |
1884 renderView()->setIsInWindow(true); | 1884 renderView()->setIsInWindow(true); |
1885 | 1885 |
1886 recalcStyle(Force); | 1886 recalcStyle(Force); |
1887 | 1887 |
1888 ContainerNode::attach(); | 1888 ContainerNode::attach(context); |
1889 } | 1889 } |
1890 | 1890 |
1891 void Document::detach() | 1891 void Document::detach(const AttachContext& context) |
1892 { | 1892 { |
1893 ASSERT(attached()); | 1893 ASSERT(attached()); |
1894 | 1894 |
1895 if (page()) | 1895 if (page()) |
1896 page()->pointerLockController()->documentDetached(this); | 1896 page()->pointerLockController()->documentDetached(this); |
1897 | 1897 |
1898 if (this == topDocument()) | 1898 if (this == topDocument()) |
1899 clearAXObjectCache(); | 1899 clearAXObjectCache(); |
1900 | 1900 |
1901 stopActiveDOMObjects(); | 1901 stopActiveDOMObjects(); |
(...skipping 22 matching lines...) Expand all Loading... |
1924 // indicate destruction mode, i.e. attached() but renderer == 0 | 1924 // indicate destruction mode, i.e. attached() but renderer == 0 |
1925 setRenderer(0); | 1925 setRenderer(0); |
1926 | 1926 |
1927 if (m_fullScreenRenderer) | 1927 if (m_fullScreenRenderer) |
1928 setFullScreenRenderer(0); | 1928 setFullScreenRenderer(0); |
1929 | 1929 |
1930 m_hoverNode = 0; | 1930 m_hoverNode = 0; |
1931 m_focusedNode = 0; | 1931 m_focusedNode = 0; |
1932 m_activeElement = 0; | 1932 m_activeElement = 0; |
1933 | 1933 |
1934 ContainerNode::detach(); | 1934 ContainerNode::detach(context); |
1935 | 1935 |
1936 unscheduleStyleRecalc(); | 1936 unscheduleStyleRecalc(); |
1937 | 1937 |
1938 if (render) | 1938 if (render) |
1939 render->destroy(); | 1939 render->destroy(); |
1940 | 1940 |
1941 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument()) | 1941 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument()) |
1942 parentDocument()->didRemoveEventTargetNode(this); | 1942 parentDocument()->didRemoveEventTargetNode(this); |
1943 | 1943 |
1944 // This is required, as our Frame might delete itself as soon as it detaches | 1944 // This is required, as our Frame might delete itself as soon as it detaches |
(...skipping 3494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5439 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; | 5439 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; |
5440 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; | 5440 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; |
5441 | 5441 |
5442 // Locate the common ancestor render object for the two renderers. | 5442 // Locate the common ancestor render object for the two renderers. |
5443 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
); | 5443 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
); |
5444 | 5444 |
5445 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; | 5445 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; |
5446 Vector<RefPtr<Node>, 32> nodesToAddToChain; | 5446 Vector<RefPtr<Node>, 32> nodesToAddToChain; |
5447 | 5447 |
5448 if (oldHoverObj != newHoverObj) { | 5448 if (oldHoverObj != newHoverObj) { |
| 5449 // If the old hovered node is not nil but it's renderer is, it was proba
bly detached as part of the :hover style |
| 5450 // (for instance by setting display:none in the :hover pseudo-class). In
this case, the old hovered element |
| 5451 // must be updated, to ensure it's normal style is re-applied. |
| 5452 if (oldHoverNode && !oldHoverObj) { |
| 5453 if (!mustBeInActiveChain || oldHoverNode->inActiveChain()) |
| 5454 nodesToRemoveFromChain.append(oldHoverNode); |
| 5455 } |
| 5456 |
5449 // The old hover path only needs to be cleared up to (and not including)
the common ancestor; | 5457 // The old hover path only needs to be cleared up to (and not including)
the common ancestor; |
5450 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr =
curr->hoverAncestor()) { | 5458 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr =
curr->hoverAncestor()) { |
5451 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
->node()->inActiveChain())) | 5459 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
->node()->inActiveChain())) |
5452 nodesToRemoveFromChain.append(curr->node()); | 5460 nodesToRemoveFromChain.append(curr->node()); |
5453 } | 5461 } |
5454 } | 5462 } |
5455 | 5463 |
5456 // Now set the hover state for our new object up to the root. | 5464 // Now set the hover state for our new object up to the root. |
5457 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { | 5465 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { |
5458 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
de()->inActiveChain())) | 5466 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
de()->inActiveChain())) |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5616 return; | 5624 return; |
5617 | 5625 |
5618 Vector<RefPtr<Element> > associatedFormControls; | 5626 Vector<RefPtr<Element> > associatedFormControls; |
5619 copyToVector(m_associatedFormControls, associatedFormControls); | 5627 copyToVector(m_associatedFormControls, associatedFormControls); |
5620 | 5628 |
5621 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC
ontrols); | 5629 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC
ontrols); |
5622 m_associatedFormControls.clear(); | 5630 m_associatedFormControls.clear(); |
5623 } | 5631 } |
5624 | 5632 |
5625 } // namespace WebCore | 5633 } // namespace WebCore |
OLD | NEW |