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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1765933003: style: Rename the PseudoId enum values to CamelCase and prefix them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-clash-PseudoId: none Created 4 years, 9 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 , noninherited_flags(o.noninherited_flags) 155 , noninherited_flags(o.noninherited_flags)
156 { 156 {
157 } 157 }
158 158
159 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, const C omputedStyle& newStyle) 159 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, const C omputedStyle& newStyle)
160 { 160 {
161 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n ot NoChange 161 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n ot NoChange
162 // because setStyle will do the right thing with anything else. 162 // because setStyle will do the right thing with anything else.
163 if (!oldStyle.hasAnyPublicPseudoStyles()) 163 if (!oldStyle.hasAnyPublicPseudoStyles())
164 return NoChange; 164 return NoChange;
165 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PS EUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { 165 for (PseudoId pseudoId = FirstPublicPseudoId; pseudoId < FirstInternalPseudo Id; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
166 if (!oldStyle.hasPseudoStyle(pseudoId)) 166 if (!oldStyle.hasPseudoStyle(pseudoId))
167 continue; 167 continue;
168 const ComputedStyle* newPseudoStyle = newStyle.getCachedPseudoStyle(pseu doId); 168 const ComputedStyle* newPseudoStyle = newStyle.getCachedPseudoStyle(pseu doId);
169 if (!newPseudoStyle) 169 if (!newPseudoStyle)
170 return NoInherit; 170 return NoInherit;
171 const ComputedStyle* oldPseudoStyle = oldStyle.getCachedPseudoStyle(pseu doId); 171 const ComputedStyle* oldPseudoStyle = oldStyle.getCachedPseudoStyle(pseu doId);
172 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle) 172 if (oldPseudoStyle && *oldPseudoStyle != *newPseudoStyle)
173 return NoInherit; 173 return NoInherit;
174 } 174 }
175 return NoChange; 175 return NoChange;
176 } 176 }
177 177
178 StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt yle, const ComputedStyle* newStyle) 178 StyleRecalcChange ComputedStyle::stylePropagationDiff(const ComputedStyle* oldSt yle, const ComputedStyle* newStyle)
179 { 179 {
180 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) 180 if ((!oldStyle && newStyle) || (oldStyle && !newStyle))
181 return Reattach; 181 return Reattach;
182 182
183 if (!oldStyle && !newStyle) 183 if (!oldStyle && !newStyle)
184 return NoChange; 184 return NoChange;
185 185
186 if (oldStyle->display() != newStyle->display() 186 if (oldStyle->display() != newStyle->display()
187 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER) 187 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS tyle(PseudoIdFirstLetter)
188 || !oldStyle->contentDataEquivalent(newStyle) 188 || !oldStyle->contentDataEquivalent(newStyle)
189 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() 189 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()
190 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava ): We must avoid this Reattach. 190 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava ): We must avoid this Reattach.
191 return Reattach; 191 return Reattach;
192 192
193 if (oldStyle->inheritedNotEqual(*newStyle)) 193 if (oldStyle->inheritedNotEqual(*newStyle))
194 return Inherit; 194 return Inherit;
195 195
196 if (*oldStyle == *newStyle) 196 if (*oldStyle == *newStyle)
197 return diffPseudoStyles(*oldStyle, *newStyle); 197 return diffPseudoStyles(*oldStyle, *newStyle);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 && m_svgStyle == o.m_svgStyle; 353 && m_svgStyle == o.m_svgStyle;
354 } 354 }
355 355
356 bool ComputedStyle::isStyleAvailable() const 356 bool ComputedStyle::isStyleAvailable() const
357 { 357 {
358 return this != StyleResolver::styleNotYetAvailable(); 358 return this != StyleResolver::styleNotYetAvailable();
359 } 359 }
360 360
361 bool ComputedStyle::hasUniquePseudoStyle() const 361 bool ComputedStyle::hasUniquePseudoStyle() const
362 { 362 {
363 if (!m_cachedPseudoStyles || styleType() != NOPSEUDO) 363 if (!m_cachedPseudoStyles || styleType() != PseudoIdNone)
364 return false; 364 return false;
365 365
366 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) { 366 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
367 const ComputedStyle& pseudoStyle = *m_cachedPseudoStyles->at(i); 367 const ComputedStyle& pseudoStyle = *m_cachedPseudoStyles->at(i);
368 if (pseudoStyle.unique()) 368 if (pseudoStyle.unique())
369 return true; 369 return true;
370 } 370 }
371 371
372 return false; 372 return false;
373 } 373 }
374 374
375 ComputedStyle* ComputedStyle::getCachedPseudoStyle(PseudoId pid) const 375 ComputedStyle* ComputedStyle::getCachedPseudoStyle(PseudoId pid) const
376 { 376 {
377 if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size()) 377 if (!m_cachedPseudoStyles || !m_cachedPseudoStyles->size())
378 return 0; 378 return 0;
379 379
380 if (styleType() != NOPSEUDO) 380 if (styleType() != PseudoIdNone)
381 return 0; 381 return 0;
382 382
383 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) { 383 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) {
384 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); 384 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get();
385 if (pseudoStyle->styleType() == pid) 385 if (pseudoStyle->styleType() == pid)
386 return pseudoStyle; 386 return pseudoStyle;
387 } 387 }
388 388
389 return 0; 389 return 0;
390 } 390 }
391 391
392 ComputedStyle* ComputedStyle::addCachedPseudoStyle(PassRefPtr<ComputedStyle> pse udo) 392 ComputedStyle* ComputedStyle::addCachedPseudoStyle(PassRefPtr<ComputedStyle> pse udo)
393 { 393 {
394 if (!pseudo) 394 if (!pseudo)
395 return 0; 395 return 0;
396 396
397 ASSERT(pseudo->styleType() > NOPSEUDO); 397 ASSERT(pseudo->styleType() > PseudoIdNone);
398 398
399 ComputedStyle* result = pseudo.get(); 399 ComputedStyle* result = pseudo.get();
400 400
401 if (!m_cachedPseudoStyles) 401 if (!m_cachedPseudoStyles)
402 m_cachedPseudoStyles = adoptPtr(new PseudoStyleCache); 402 m_cachedPseudoStyles = adoptPtr(new PseudoStyleCache);
403 403
404 m_cachedPseudoStyles->append(pseudo); 404 m_cachedPseudoStyles->append(pseudo);
405 405
406 return result; 406 return result;
407 } 407 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 657 }
658 658
659 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) 659 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE))
660 return true; 660 return true;
661 661
662 if (!m_background->outline().visuallyEqual(other.m_background->outline())) { 662 if (!m_background->outline().visuallyEqual(other.m_background->outline())) {
663 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it. 663 // FIXME: We only really need to recompute the overflow but we don't hav e an optimized layout for it.
664 return true; 664 return true;
665 } 665 }
666 666
667 if (hasPseudoStyle(SCROLLBAR) != other.hasPseudoStyle(SCROLLBAR)) 667 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll bar))
668 return true; 668 return true;
669 669
670 // Movement of non-static-positioned object is special cased in ComputedStyl e::visualInvalidationDiff(). 670 // Movement of non-static-positioned object is special cased in ComputedStyl e::visualInvalidationDiff().
671 671
672 return false; 672 return false;
673 } 673 }
674 674
675 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const 675 bool ComputedStyle::diffNeedsFullLayout(const ComputedStyle& other) const
676 { 676 {
677 if (m_box.get() != other.m_box.get()) { 677 if (m_box.get() != other.m_box.get()) {
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 if (!shadowList) 1881 if (!shadowList)
1882 return false; 1882 return false;
1883 for (size_t i = shadowList->shadows().size(); i--; ) { 1883 for (size_t i = shadowList->shadows().size(); i--; ) {
1884 if (shadowList->shadows()[i].color().isCurrentColor()) 1884 if (shadowList->shadows()[i].color().isCurrentColor())
1885 return true; 1885 return true;
1886 } 1886 }
1887 return false; 1887 return false;
1888 } 1888 }
1889 1889
1890 } // namespace blink 1890 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698