Commit 395cd888 authored by antti@apple.com's avatar antti@apple.com

Remove NodeRenderingContext

https://bugs.webkit.org/show_bug.cgi?id=120466

Reviewed by Andreas Kling.

Switch the few remaining clients of this class to call the underlying code directly.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::initForStyleResolve):
* dom/DOMAllInOne.cpp:
* dom/Node.cpp:
* dom/Node.h:
        
    Remove Node::parentNodeForRenderingAndStyle(). Make clients invoke NodeRenderingTraversal::parent() directly.

* dom/NodeRenderingContext.cpp: Removed.
* dom/NodeRenderingContext.h: Removed.
* dom/ShadowRoot.h:
* dom/Text.cpp:
* dom/Text.h:
* dom/TreeScope.cpp:
* dom/TreeScope.h:
            
    Remove virtual TreeScope::resetStyleInheritance. Make clients cast to ShadowRoot when needed.

* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::detailsElement):
* style/StyleResolveTree.cpp:
(WebCore::Style::createTextRendererIfNeeded):
        
    For consistency switch resetStyleInheritance check to use parentNode() instead of renderingParentNode. This matches the NodeRenderingTraversal implementation.
    This difference is probably not testable in current trunk.

(WebCore::Style::resolveTree):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154809 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8e2ce0d1
......@@ -1198,7 +1198,6 @@ set(WebCore_SOURCES
dom/NodeFilter.cpp
dom/NodeIterator.cpp
dom/NodeRareData.cpp
dom/NodeRenderingContext.cpp
dom/NodeRenderingTraversal.cpp
dom/NodeTraversal.cpp
dom/Notation.cpp
......
2013-08-29 Antti Koivisto <antti@apple.com>
Remove NodeRenderingContext
https://bugs.webkit.org/show_bug.cgi?id=120466
Reviewed by Andreas Kling.
Switch the few remaining clients of this class to call the underlying code directly.
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::initForStyleResolve):
* dom/DOMAllInOne.cpp:
* dom/Node.cpp:
* dom/Node.h:
Remove Node::parentNodeForRenderingAndStyle(). Make clients invoke NodeRenderingTraversal::parent() directly.
* dom/NodeRenderingContext.cpp: Removed.
* dom/NodeRenderingContext.h: Removed.
* dom/ShadowRoot.h:
* dom/Text.cpp:
* dom/Text.h:
* dom/TreeScope.cpp:
* dom/TreeScope.h:
Remove virtual TreeScope::resetStyleInheritance. Make clients cast to ShadowRoot when needed.
* html/HTMLSummaryElement.cpp:
(WebCore::HTMLSummaryElement::detailsElement):
* style/StyleResolveTree.cpp:
(WebCore::Style::createTextRendererIfNeeded):
For consistency switch resetStyleInheritance check to use parentNode() instead of renderingParentNode. This matches the NodeRenderingTraversal implementation.
This difference is probably not testable in current trunk.
(WebCore::Style::resolveTree):
2013-08-29 Antti Koivisto <antti@apple.com>
Move element renderer creation out of NodeRenderingContext
......@@ -2968,13 +2968,11 @@ webcore_sources += \
Source/WebCore/dom/NodeFilter.cpp \
Source/WebCore/dom/NodeFilter.h \
Source/WebCore/dom/NodeRareData.cpp \
Source/WebCore/dom/NodeRenderingContext.cpp \
Source/WebCore/dom/Node.h \
Source/WebCore/dom/NodeIterator.cpp \
Source/WebCore/dom/NodeIterator.h \
Source/WebCore/dom/NodeList.h \
Source/WebCore/dom/NodeRareData.h \
Source/WebCore/dom/NodeRenderingContext.h \
Source/WebCore/dom/NodeRenderingTraversal.h \
Source/WebCore/dom/NodeRenderingTraversal.cpp \
Source/WebCore/dom/NodeRenderStyle.h \
......
......@@ -447,7 +447,6 @@ SOURCES += \
dom/NodeFilter.cpp \
dom/NodeIterator.cpp \
dom/NodeRareData.cpp \
dom/NodeRenderingContext.cpp \
dom/NodeRenderingTraversal.cpp \
dom/NodeTraversal.cpp \
dom/Notation.cpp \
......@@ -1658,7 +1657,6 @@ HEADERS += \
dom/Node.h \
dom/NodeIterator.h \
dom/NodeRareData.h \
dom/NodeRenderingContext.h \
dom/NodeRenderingTraversal.h \
dom/NodeTraversal.h \
dom/Notation.h \
......
......@@ -665,8 +665,6 @@ __ZN7WebCore20DictationAlternativeC1Ejjy
__ZN7WebCore20DictationAlternativeC1Ev
__ZN7WebCore20DisplaySleepDisablerC1EPKc
__ZN7WebCore20DisplaySleepDisablerD1Ev
__ZN7WebCore20NodeRenderingContextC1EPNS_4NodeE
__ZN7WebCore20NodeRenderingContextD1Ev
__ZN7WebCore20RenderEmbeddedObject29setPluginUnavailabilityReasonENS0_26PluginUnavailabilityReasonE
__ZN7WebCore20RenderEmbeddedObject37setUnavailablePluginIndicatorIsHiddenEb
__ZN7WebCore20RenderEmbeddedObject44setPluginUnavailabilityReasonWithDescriptionENS0_26PluginUnavailabilityReasonERKN3WTF6StringE
......
......@@ -12981,20 +12981,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\dom\NodeRareData.cpp" />
<ClCompile Include="..\dom\NodeRenderingContext.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\dom\NodeTraversal.cpp" />
<ClCompile Include="..\dom\Notation.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
......@@ -20323,7 +20309,6 @@
<ClInclude Include="..\dom\NodeFilter.h" />
<ClInclude Include="..\dom\NodeFilterCondition.h" />
<ClInclude Include="..\dom\NodeIterator.h" />
<ClInclude Include="..\dom\NodeRenderingContext.h" />
<ClInclude Include="..\dom\NodeTraversal.h" />
<ClInclude Include="..\dom\Notation.h" />
<ClInclude Include="..\dom\OverflowEvent.h" />
......@@ -3449,8 +3449,6 @@
A7D6B34A0F61104500B79FD1 /* WorkerScriptLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */; };
A7DBF8DD1276919C006B6008 /* TextCheckingHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7DBF8DB1276919C006B6008 /* TextCheckingHelper.cpp */; };
A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */; };
A7F5D94F1384F02D00A29A87 /* NodeRenderingContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F5D94D1384F02D00A29A87 /* NodeRenderingContext.cpp */; };
A7F5D9501384F02D00A29A87 /* NodeRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F5D94E1384F02D00A29A87 /* NodeRenderingContext.h */; };
A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */; };
A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */ = {isa = PBXBuildFile; fileRef = A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */; };
A80E6CE40A1989CA007FB8C5 /* CSSValueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */; };
......@@ -9904,8 +9902,6 @@
A7F1F4BF17148BDB00CD4852 /* StorageQuotaCallback.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = StorageQuotaCallback.idl; path = Modules/quota/StorageQuotaCallback.idl; sourceTree = SOURCE_ROOT; };
A7F1F4C017148BDB00CD4852 /* StorageUsageCallback.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = StorageUsageCallback.idl; path = Modules/quota/StorageUsageCallback.idl; sourceTree = SOURCE_ROOT; };
A7F1F4C117148BDB00CD4852 /* WorkerNavigatorStorageQuota.idl */ = {isa = PBXFileReference; lastKnownFileType = text; name = WorkerNavigatorStorageQuota.idl; path = Modules/quota/WorkerNavigatorStorageQuota.idl; sourceTree = SOURCE_ROOT; };
A7F5D94D1384F02D00A29A87 /* NodeRenderingContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeRenderingContext.cpp; sourceTree = "<group>"; };
A7F5D94E1384F02D00A29A87 /* NodeRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRenderingContext.h; sourceTree = "<group>"; };
A7F73ED9169AD7AA00CBAA4B /* DOMShadowRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMShadowRoot.h; sourceTree = "<group>"; };
A7F73EDA169AD7AA00CBAA4B /* DOMShadowRoot.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMShadowRoot.mm; sourceTree = "<group>"; };
A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PatternCG.cpp; sourceTree = "<group>"; };
......@@ -20350,8 +20346,6 @@
85ACA9FA0A9B631000671E90 /* NodeList.idl */,
4FAB48661643A67E00F70C07 /* NodeRareData.cpp */,
63189AE20E83A33300012E41 /* NodeRareData.h */,
A7F5D94D1384F02D00A29A87 /* NodeRenderingContext.cpp */,
A7F5D94E1384F02D00A29A87 /* NodeRenderingContext.h */,
A7211F231678A54200957444 /* NodeRenderingTraversal.cpp */,
A7211F241678A54200957444 /* NodeRenderingTraversal.h */,
63D7B32C0E78CD3F00F7617C /* NodeRenderStyle.h */,
......@@ -22843,7 +22837,6 @@
854FE7350A2297BE0058D7AD /* NodeIterator.h in Headers */,
A818721B0977D3C0005826D9 /* NodeList.h in Headers */,
63189AE30E83A33300012E41 /* NodeRareData.h in Headers */,
A7F5D9501384F02D00A29A87 /* NodeRenderingContext.h in Headers */,
A74F3EF51678B24F00B05A6E /* NodeRenderingTraversal.h in Headers */,
63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */,
E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */,
......@@ -26038,7 +26031,6 @@
854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */,
854FE7340A2297BE0058D7AD /* NodeIterator.cpp in Sources */,
4FFC022B1643B710004E1638 /* NodeRareData.cpp in Sources */,
A7F5D94F1384F02D00A29A87 /* NodeRenderingContext.cpp in Sources */,
A74F3EF31678B24A00B05A6E /* NodeRenderingTraversal.cpp in Sources */,
E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */,
A8EA7EBF0A1945D000A8EF5F /* Notation.cpp in Sources */,
......@@ -83,7 +83,7 @@
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "NodeRenderStyle.h"
#include "NodeRenderingContext.h"
#include "NodeRenderingTraversal.h"
#include "Page.h"
#include "PageRuleCollector.h"
#include "Pair.h"
......@@ -428,9 +428,9 @@ inline void StyleResolver::State::initForStyleResolve(Document* document, Elemen
m_regionForStyling = regionForStyling;
if (e) {
NodeRenderingContext context(e);
m_parentNode = context.parentNodeForRenderingAndStyle();
m_parentStyle = context.resetStyleInheritance() ? 0 :
m_parentNode = NodeRenderingTraversal::parent(e);
bool resetStyleInheritance = hasShadowRootParent(e) && toShadowRoot(e->parentNode())->resetStyleInheritance();
m_parentStyle = resetStyleInheritance ? 0 :
parentStyle ? parentStyle :
m_parentNode ? m_parentNode->renderStyle() : 0;
} else {
......
......@@ -106,7 +106,6 @@
#include "NodeFilter.cpp"
#include "NodeFilterCondition.cpp"
#include "NodeIterator.cpp"
#include "NodeRenderingContext.cpp"
#include "NodeRenderingTraversal.cpp"
#include "Notation.cpp"
#include "OverflowEvent.cpp"
......
......@@ -79,7 +79,6 @@
#include "NameNodeList.h"
#include "NamedNodeMap.h"
#include "NodeRareData.h"
#include "NodeRenderingContext.h"
#include "NodeTraversal.h"
#include "Page.h"
#include "PlatformMouseEvent.h"
......@@ -942,11 +941,6 @@ Node* Node::pseudoAwareLastChild() const
return lastChild();
}
ContainerNode* Node::parentNodeForRenderingAndStyle()
{
return NodeRenderingContext(this).parentNodeForRenderingAndStyle();
}
RenderStyle* Node::virtualComputedStyle(PseudoId pseudoElementSpecifier)
{
return parentOrShadowHostNode() ? parentOrShadowHostNode()->computedStyle(pseudoElementSpecifier) : 0;
......
......@@ -463,8 +463,6 @@ public:
// Use these two methods with caution.
RenderBox* renderBox() const;
RenderBoxModelObject* renderBoxModelObject() const;
ContainerNode* parentNodeForRenderingAndStyle();
// Wrapper for nodes that don't have a renderer, but still cache the style (like HTMLOptionElement).
RenderStyle* renderStyle() const;
......
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "config.h"
#include "NodeRenderingContext.h"
#include "ContainerNode.h"
#include "ContentDistributor.h"
#include "FlowThreadController.h"
#include "HTMLContentElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "Node.h"
#include "PseudoElement.h"
#include "RenderFullScreen.h"
#include "RenderNamedFlowThread.h"
#include "RenderObject.h"
#include "RenderText.h"
#include "RenderView.h"
#include "ShadowRoot.h"
#include "StyleInheritedData.h"
#include "StyleResolver.h"
#include "Text.h"
#if ENABLE(SVG)
#include "SVGNames.h"
#endif
namespace WebCore {
using namespace HTMLNames;
NodeRenderingContext::NodeRenderingContext(Node* node)
: m_node(node)
{
m_renderingParent = NodeRenderingTraversal::parent(node);
}
NodeRenderingContext::~NodeRenderingContext()
{
}
static bool isRendererReparented(const RenderObject* renderer)
{
if (!renderer->node()->isElementNode())
return false;
if (renderer->style() && !renderer->style()->flowThread().isEmpty())
return true;
#if ENABLE(DIALOG_ELEMENT)
if (toElement(renderer->node())->isInTopLayer())
return true;
#endif
return false;
}
RenderObject* NodeRenderingContext::nextRenderer() const
{
if (RenderObject* renderer = m_node->renderer())
return renderer->nextSibling();
#if ENABLE(DIALOG_ELEMENT)
Element* element = m_node->isElementNode() ? toElement(m_node) : 0;
if (element && element->isInTopLayer()) {
const Vector<RefPtr<Element> >& topLayerElements = element->document()->topLayerElements();
size_t position = topLayerElements.find(element);
ASSERT(position != notFound);
for (size_t i = position + 1; i < topLayerElements.size(); ++i) {
if (RenderObject* renderer = topLayerElements[i]->renderer())
return renderer;
}
return 0;
}
#endif
// Avoid an O(N^2) problem with this function by not checking for
// nextRenderer() when the parent element hasn't attached yet.
if (m_renderingParent && !m_renderingParent->attached())
return 0;
for (Node* sibling = NodeRenderingTraversal::nextSibling(m_node); sibling; sibling = NodeRenderingTraversal::nextSibling(sibling)) {
RenderObject* renderer = sibling->renderer();
if (renderer && !isRendererReparented(renderer))
return renderer;
}
return 0;
}
RenderObject* NodeRenderingContext::previousRenderer() const
{
if (RenderObject* renderer = m_node->renderer())
return renderer->previousSibling();
#if ENABLE(DIALOG_ELEMENT)
// FIXME: This doesn't work correctly for things in the top layer that are
// display: none. We'd need to duplicate the logic in nextRenderer, but since
// nothing needs that yet just assert.
ASSERT(!m_node->isElementNode() || !toElement(m_node)->isInTopLayer());
#endif
// FIXME: We should have the same O(N^2) avoidance as nextRenderer does
// however, when I tried adding it, several tests failed.
for (Node* sibling = NodeRenderingTraversal::previousSibling(m_node); sibling; sibling = NodeRenderingTraversal::previousSibling(sibling)) {
RenderObject* renderer = sibling->renderer();
if (renderer && !isRendererReparented(renderer))
return renderer;
}
return 0;
}
RenderObject* NodeRenderingContext::parentRenderer() const
{
if (RenderObject* renderer = m_node->renderer())
return renderer->parent();
#if ENABLE(DIALOG_ELEMENT)
if (m_node->isElementNode() && toElement(m_node)->isInTopLayer()) {
// The parent renderer of top layer elements is the RenderView, but only
// if the normal parent would have had a renderer.
// FIXME: This behavior isn't quite right as the spec for top layer
// only talks about display: none ancestors so putting a <dialog> inside
// an <optgroup> seems like it should still work even though this check
// will prevent it.
if (!m_renderingParent || !m_renderingParent->renderer())
return 0;
return m_node->document()->renderView();
}
#endif
return m_renderingParent ? m_renderingParent->renderer() : 0;
}
bool NodeRenderingContext::resetStyleInheritance() const
{
ContainerNode* parent = m_node->parentNode();
return parent && parent->isShadowRoot() && toShadowRoot(parent)->resetStyleInheritance();
}
}
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef NodeRenderingContext_h
#define NodeRenderingContext_h
#include "NodeRenderingTraversal.h"
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
class ContainerNode;
class Node;
class RenderObject;
class NodeRenderingContext {
public:
explicit NodeRenderingContext(Node*);
~NodeRenderingContext();
Node* node() const;
ContainerNode* parentNodeForRenderingAndStyle() const;
bool resetStyleInheritance() const;
RenderObject* parentRenderer() const;
RenderObject* nextRenderer() const;
RenderObject* previousRenderer() const;
private:
Node* m_node;
ContainerNode* m_renderingParent;
};
inline Node* NodeRenderingContext::node() const
{
return m_node;
}
inline ContainerNode* NodeRenderingContext::parentNodeForRenderingAndStyle() const
{
return m_renderingParent;
}
} // namespace WebCore
#endif
......@@ -58,7 +58,7 @@ public:
virtual bool applyAuthorStyles() const OVERRIDE { return m_applyAuthorStyles; }
void setApplyAuthorStyles(bool);
virtual bool resetStyleInheritance() const OVERRIDE { return m_resetStyleInheritance; }
bool resetStyleInheritance() const { return m_resetStyleInheritance; }
void setResetStyleInheritance(bool);
Element* hostElement() const { return m_hostElement; }
......
......@@ -24,7 +24,6 @@
#include "ExceptionCode.h"
#include "ExceptionCodePlaceholder.h"
#include "NodeRenderingContext.h"
#include "RenderCombineText.h"
#include "RenderText.h"
#include "ScopedEventQueue.h"
......
......@@ -28,7 +28,6 @@
namespace WebCore {
class NodeRenderingContext;
class RenderText;
class Text : public CharacterData {
......
......@@ -361,11 +361,6 @@ bool TreeScope::applyAuthorStyles() const
return true;
}
bool TreeScope::resetStyleInheritance() const
{
return false;
}
void TreeScope::adoptIfNeeded(Node* node)
{
ASSERT(this);
......
......@@ -94,7 +94,6 @@ public:
Element* findAnchor(const String& name);
virtual bool applyAuthorStyles() const;
virtual bool resetStyleInheritance() const;
// Used by the basic DOM mutation methods (e.g., appendChild()).
void adoptIfNeeded(Node*);
......
......@@ -28,6 +28,7 @@
#include "HTMLNames.h"
#include "KeyboardEvent.h"
#include "MouseEvent.h"
#include "NodeRenderingTraversal.h"
#include "PlatformMouseEvent.h"
#include "RenderBlock.h"
#include "ShadowRoot.h"
......@@ -86,7 +87,7 @@ void HTMLSummaryElement::didAddUserAgentShadowRoot(ShadowRoot* root)
HTMLDetailsElement* HTMLSummaryElement::detailsElement() const
{
Node* mayDetails = const_cast<HTMLSummaryElement*>(this)->parentNodeForRenderingAndStyle();
Node* mayDetails = NodeRenderingTraversal::parent(this);
if (!mayDetails || !mayDetails->hasTagName(detailsTag))
return 0;
return static_cast<HTMLDetailsElement*>(mayDetails);
......
......@@ -32,7 +32,7 @@
#include "ElementTraversal.h"
#include "FlowThreadController.h"
#include "NodeRenderStyle.h"
#include "NodeRenderingContext.h"
#include "NodeRenderingTraversal.h"
#include "NodeTraversal.h"
#include "RenderFullScreen.h"
#include "RenderNamedFlowThread.h"
......@@ -346,7 +346,7 @@ static void createTextRendererIfNeeded(Text& textNode)
Document* document = textNode.document();
RefPtr<RenderStyle> style;
bool resetStyleInheritance = renderingParentNode->isShadowRoot() && toShadowRoot(renderingParentNode)->resetStyleInheritance();
bool resetStyleInheritance = textNode.parentNode()->isShadowRoot() && toShadowRoot(textNode.parentNode())->resetStyleInheritance();
if (resetStyleInheritance)
style = document->ensureStyleResolver().defaultStyleForElement();
else
......@@ -692,7 +692,8 @@ void resolveTree(Element* current, Change change)
return;
}
bool hasParentStyle = current->parentNodeForRenderingAndStyle() && current->parentNodeForRenderingAndStyle()->renderStyle();
ContainerNode* renderingParentNode = NodeRenderingTraversal::parent(current);
bool hasParentStyle = renderingParentNode && renderingParentNode->renderStyle();
bool hasDirectAdjacentRules = current->childrenAffectedByDirectAdjacentRules();
bool hasIndirectAdjacentRules = current->childrenAffectedByForwardPositionalRules();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment