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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); | 1860 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); |
1861 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles)
); | 1861 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles)
); |
1862 m_styleSheetCollection->combineCSSFeatureFlags(); | 1862 m_styleSheetCollection->combineCSSFeatureFlags(); |
1863 } | 1863 } |
1864 | 1864 |
1865 void Document::clearStyleResolver() | 1865 void Document::clearStyleResolver() |
1866 { | 1866 { |
1867 m_styleResolver.clear(); | 1867 m_styleResolver.clear(); |
1868 } | 1868 } |
1869 | 1869 |
1870 void Document::attach() | 1870 void Document::attach(const AttachContext& context) |
1871 { | 1871 { |
1872 ASSERT(!attached()); | 1872 ASSERT(!attached()); |
1873 ASSERT(!m_axObjectCache || this != topDocument()); | 1873 ASSERT(!m_axObjectCache || this != topDocument()); |
1874 | 1874 |
1875 if (!m_renderArena) | 1875 if (!m_renderArena) |
1876 m_renderArena = adoptPtr(new RenderArena); | 1876 m_renderArena = adoptPtr(new RenderArena); |
1877 | 1877 |
1878 // Create the rendering tree | 1878 // Create the rendering tree |
1879 setRenderer(new (m_renderArena.get()) RenderView(this)); | 1879 setRenderer(new (m_renderArena.get()) RenderView(this)); |
1880 renderView()->setIsInWindow(true); | 1880 renderView()->setIsInWindow(true); |
1881 | 1881 |
1882 recalcStyle(Force); | 1882 recalcStyle(Force); |
1883 | 1883 |
1884 ContainerNode::attach(); | 1884 ContainerNode::attach(context); |
1885 } | 1885 } |
1886 | 1886 |
1887 void Document::detach() | 1887 void Document::detach(const AttachContext& context) |
1888 { | 1888 { |
1889 ASSERT(attached()); | 1889 ASSERT(attached()); |
1890 | 1890 |
1891 if (page()) | 1891 if (page()) |
1892 page()->pointerLockController()->documentDetached(this); | 1892 page()->pointerLockController()->documentDetached(this); |
1893 | 1893 |
1894 if (this == topDocument()) | 1894 if (this == topDocument()) |
1895 clearAXObjectCache(); | 1895 clearAXObjectCache(); |
1896 | 1896 |
1897 stopActiveDOMObjects(); | 1897 stopActiveDOMObjects(); |
(...skipping 22 matching lines...) Expand all Loading... |
1920 // indicate destruction mode, i.e. attached() but renderer == 0 | 1920 // indicate destruction mode, i.e. attached() but renderer == 0 |
1921 setRenderer(0); | 1921 setRenderer(0); |
1922 | 1922 |
1923 if (m_fullScreenRenderer) | 1923 if (m_fullScreenRenderer) |
1924 setFullScreenRenderer(0); | 1924 setFullScreenRenderer(0); |
1925 | 1925 |
1926 m_hoverNode = 0; | 1926 m_hoverNode = 0; |
1927 m_focusedNode = 0; | 1927 m_focusedNode = 0; |
1928 m_activeElement = 0; | 1928 m_activeElement = 0; |
1929 | 1929 |
1930 ContainerNode::detach(); | 1930 ContainerNode::detach(context); |
1931 | 1931 |
1932 unscheduleStyleRecalc(); | 1932 unscheduleStyleRecalc(); |
1933 | 1933 |
1934 if (render) | 1934 if (render) |
1935 render->destroy(); | 1935 render->destroy(); |
1936 | 1936 |
1937 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument()) | 1937 if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument()) |
1938 parentDocument()->didRemoveEventTargetNode(this); | 1938 parentDocument()->didRemoveEventTargetNode(this); |
1939 | 1939 |
1940 // This is required, as our Frame might delete itself as soon as it detaches | 1940 // This is required, as our Frame might delete itself as soon as it detaches |
(...skipping 3477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5418 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; | 5418 RenderObject* oldHoverObj = oldHoverNode ? oldHoverNode->renderer() : 0; |
5419 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; | 5419 RenderObject* newHoverObj = newHoverNode ? newHoverNode->renderer() : 0; |
5420 | 5420 |
5421 // Locate the common ancestor render object for the two renderers. | 5421 // Locate the common ancestor render object for the two renderers. |
5422 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
); | 5422 RenderObject* ancestor = nearestCommonHoverAncestor(oldHoverObj, newHoverObj
); |
5423 | 5423 |
5424 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; | 5424 Vector<RefPtr<Node>, 32> nodesToRemoveFromChain; |
5425 Vector<RefPtr<Node>, 32> nodesToAddToChain; | 5425 Vector<RefPtr<Node>, 32> nodesToAddToChain; |
5426 | 5426 |
5427 if (oldHoverObj != newHoverObj) { | 5427 if (oldHoverObj != newHoverObj) { |
| 5428 // If the old hovered node is not nil but it's renderer is, it was proba
bly detached as part of the :hover style |
| 5429 // (for instance by setting display:none in the :hover pseudo-class). In
this case, the old hovered element |
| 5430 // must be updated, to ensure it's normal style is re-applied. |
| 5431 if (oldHoverNode && !oldHoverObj) { |
| 5432 if (!mustBeInActiveChain || oldHoverNode->inActiveChain()) |
| 5433 nodesToRemoveFromChain.append(oldHoverNode); |
| 5434 } |
| 5435 |
5428 // The old hover path only needs to be cleared up to (and not including)
the common ancestor; | 5436 // The old hover path only needs to be cleared up to (and not including)
the common ancestor; |
5429 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr =
curr->hoverAncestor()) { | 5437 for (RenderObject* curr = oldHoverObj; curr && curr != ancestor; curr =
curr->hoverAncestor()) { |
5430 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
->node()->inActiveChain())) | 5438 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr
->node()->inActiveChain())) |
5431 nodesToRemoveFromChain.append(curr->node()); | 5439 nodesToRemoveFromChain.append(curr->node()); |
5432 } | 5440 } |
5433 } | 5441 } |
5434 | 5442 |
5435 // Now set the hover state for our new object up to the root. | 5443 // Now set the hover state for our new object up to the root. |
5436 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { | 5444 for (RenderObject* curr = newHoverObj; curr; curr = curr->hoverAncestor()) { |
5437 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
de()->inActiveChain())) | 5445 if (curr->node() && !curr->isText() && (!mustBeInActiveChain || curr->no
de()->inActiveChain())) |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5595 return; | 5603 return; |
5596 | 5604 |
5597 Vector<RefPtr<Element> > associatedFormControls; | 5605 Vector<RefPtr<Element> > associatedFormControls; |
5598 copyToVector(m_associatedFormControls, associatedFormControls); | 5606 copyToVector(m_associatedFormControls, associatedFormControls); |
5599 | 5607 |
5600 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC
ontrols); | 5608 frame()->page()->chrome().client()->didAssociateFormControls(associatedFormC
ontrols); |
5601 m_associatedFormControls.clear(); | 5609 m_associatedFormControls.clear(); |
5602 } | 5610 } |
5603 | 5611 |
5604 } // namespace WebCore | 5612 } // namespace WebCore |
OLD | NEW |