Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp

Issue 2685113002: Cleanup SVGElement::layoutObjectIsNeeded. (Closed)
Patch Set: Preserving behavior Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
8 * (http://www.torchmobile.com/) 8 * (http://www.torchmobile.com/)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 return m_layoutObjectParent; 84 return m_layoutObjectParent;
85 } 85 }
86 86
87 DISABLE_CFI_PERF 87 DISABLE_CFI_PERF
88 bool LayoutTreeBuilderForElement::shouldCreateLayoutObject() const { 88 bool LayoutTreeBuilderForElement::shouldCreateLayoutObject() const {
89 if (!m_layoutObjectParent) 89 if (!m_layoutObjectParent)
90 return false; 90 return false;
91 91
92 // FIXME: Should the following be in SVGElement::layoutObjectIsNeeded()?
93 if (m_node->isSVGElement()) {
94 // SVG elements only render when inside <svg>, or if the element is an <svg>
95 // itself.
96 if (!isSVGSVGElement(*m_node) &&
97 (!m_layoutObjectParent->node() ||
98 !m_layoutObjectParent->node()->isSVGElement()))
99 return false;
100 if (!toSVGElement(m_node)->isValid())
101 return false;
102 }
103
104 LayoutObject* parentLayoutObject = this->parentLayoutObject(); 92 LayoutObject* parentLayoutObject = this->parentLayoutObject();
105 if (!parentLayoutObject) 93 if (!parentLayoutObject)
106 return false; 94 return false;
107 if (!parentLayoutObject->canHaveChildren()) 95 if (!parentLayoutObject->canHaveChildren())
108 return false; 96 return false;
109 97
110 return m_node->layoutObjectIsNeeded(style()); 98 return m_node->layoutObjectIsNeeded(style());
111 } 99 }
112 100
113 ComputedStyle& LayoutTreeBuilderForElement::style() const { 101 ComputedStyle& LayoutTreeBuilderForElement::style() const {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 m_layoutObjectParent->isInsideFlowThread()); 162 m_layoutObjectParent->isInsideFlowThread());
175 163
176 LayoutObject* nextLayoutObject = this->nextLayoutObject(); 164 LayoutObject* nextLayoutObject = this->nextLayoutObject();
177 m_node->setLayoutObject(newLayoutObject); 165 m_node->setLayoutObject(newLayoutObject);
178 // Parent takes care of the animations, no need to call setAnimatableStyle. 166 // Parent takes care of the animations, no need to call setAnimatableStyle.
179 newLayoutObject->setStyle(&style); 167 newLayoutObject->setStyle(&style);
180 m_layoutObjectParent->addChild(newLayoutObject, nextLayoutObject); 168 m_layoutObjectParent->addChild(newLayoutObject, nextLayoutObject);
181 } 169 }
182 170
183 } // namespace blink 171 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698