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

Side by Side Diff: Source/core/rendering/style/RenderStyle.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix a crashers (everything is building!) Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 static StyleRecalcChange diffPseudoStyles(const RenderStyle* oldStyle, const Ren derStyle* newStyle) 154 static StyleRecalcChange diffPseudoStyles(const RenderStyle* oldStyle, const Ren derStyle* newStyle)
155 { 155 {
156 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n ot NoChange 156 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n ot NoChange
157 // because setStyle will do the right thing with anything else. 157 // because setStyle will do the right thing with anything else.
158 if (!oldStyle->hasAnyPublicPseudoStyles()) 158 if (!oldStyle->hasAnyPublicPseudoStyles())
159 return NoChange; 159 return NoChange;
160 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PS EUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { 160 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PS EUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
161 if (!oldStyle->hasPseudoStyle(pseudoId)) 161 if (!oldStyle->hasPseudoStyle(pseudoId))
162 continue; 162 continue;
163 RenderStyle* newPseudoStyle = newStyle->getCachedPseudoStyle(pseudoId); 163 const RenderStyle* newPseudoStyle = newStyle->getCachedPseudoStyle(pseud oId);
164 if (!newPseudoStyle) 164 if (!newPseudoStyle)
165 return NoInherit; 165 return NoInherit;
166 RenderStyle* oldPseudoStyle = oldStyle->getCachedPseudoStyle(pseudoId); 166 const RenderStyle* oldPseudoStyle = oldStyle->getCachedPseudoStyle(pseud oId);
167 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) 167 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle)
168 return NoInherit; 168 return NoInherit;
169 } 169 }
170 return NoChange; 170 return NoChange;
171 } 171 }
172 172
173 StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle, const RenderStyle* newStyle) 173 StyleRecalcChange RenderStyle::stylePropagationDiff(const RenderStyle* oldStyle, const RenderStyle* newStyle)
174 { 174 {
175 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) 175 if ((!oldStyle && newStyle) || (oldStyle && !newStyle))
176 return Reattach; 176 return Reattach;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 m_cachedPseudoStyles->append(pseudo); 322 m_cachedPseudoStyles->append(pseudo);
323 323
324 return result; 324 return result;
325 } 325 }
326 326
327 void RenderStyle::removeCachedPseudoStyle(PseudoId pid) 327 void RenderStyle::removeCachedPseudoStyle(PseudoId pid)
328 { 328 {
329 if (!m_cachedPseudoStyles) 329 if (!m_cachedPseudoStyles)
330 return; 330 return;
331 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) { 331 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
332 RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); 332 const RenderStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
333 if (pseudoStyle->styleType() == pid) { 333 if (pseudoStyle->styleType() == pid) {
334 m_cachedPseudoStyles->remove(i); 334 m_cachedPseudoStyles->remove(i);
335 return; 335 return;
336 } 336 }
337 } 337 }
338 } 338 }
339 339
340 bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const 340 bool RenderStyle::inheritedNotEqual(const RenderStyle* other) const
341 { 341 {
342 return inherited_flags != other->inherited_flags 342 return inherited_flags != other->inherited_flags
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 horizontal || includeLogicalRightEdge); 1657 horizontal || includeLogicalRightEdge);
1658 1658
1659 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1659 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1660 visitedDependentColor(CSSPropertyBorderLeftColor), 1660 visitedDependentColor(CSSPropertyBorderLeftColor),
1661 borderLeftStyle(), 1661 borderLeftStyle(),
1662 borderLeftIsTransparent(), 1662 borderLeftIsTransparent(),
1663 !horizontal || includeLogicalLeftEdge); 1663 !horizontal || includeLogicalLeftEdge);
1664 } 1664 }
1665 1665
1666 } // namespace blink 1666 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698