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

Side by Side Diff: Source/core/css/resolver/SharedStyleFinder.cpp

Issue 192373005: Use new is*Element() helper functions in CSS code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "core/svg/SVGElement.h" 51 #include "core/svg/SVGElement.h"
52 #include "wtf/HashSet.h" 52 #include "wtf/HashSet.h"
53 #include "wtf/text/AtomicString.h" 53 #include "wtf/text/AtomicString.h"
54 54
55 namespace WebCore { 55 namespace WebCore {
56 56
57 using namespace HTMLNames; 57 using namespace HTMLNames;
58 58
59 bool SharedStyleFinder::canShareStyleWithControl(Element& candidate) const 59 bool SharedStyleFinder::canShareStyleWithControl(Element& candidate) const
60 { 60 {
61 if (!candidate.hasTagName(inputTag) || !element().hasTagName(inputTag)) 61 if (!isHTMLInputElement(candidate) || !isHTMLInputElement(element()))
62 return false; 62 return false;
63 63
64 HTMLInputElement& candidateInput = toHTMLInputElement(candidate); 64 HTMLInputElement& candidateInput = toHTMLInputElement(candidate);
65 HTMLInputElement& thisInput = toHTMLInputElement(element()); 65 HTMLInputElement& thisInput = toHTMLInputElement(element());
66 66
67 if (candidateInput.isAutofilled() != thisInput.isAutofilled()) 67 if (candidateInput.isAutofilled() != thisInput.isAutofilled())
68 return false; 68 return false;
69 if (candidateInput.shouldAppearChecked() != thisInput.shouldAppearChecked()) 69 if (candidateInput.shouldAppearChecked() != thisInput.shouldAppearChecked())
70 return false; 70 return false;
71 if (candidateInput.shouldAppearIndeterminate() != thisInput.shouldAppearInde terminate()) 71 if (candidateInput.shouldAppearIndeterminate() != thisInput.shouldAppearInde terminate())
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } else { 144 } else {
145 return false; 145 return false;
146 } 146 }
147 147
148 if (element().presentationAttributeStyle() != candidate.presentationAttribut eStyle()) 148 if (element().presentationAttributeStyle() != candidate.presentationAttribut eStyle())
149 return false; 149 return false;
150 150
151 // FIXME: Consider removing this, it's unlikely we'll have so many progress elements 151 // FIXME: Consider removing this, it's unlikely we'll have so many progress elements
152 // that sharing the style makes sense. Instead we should just not support st yle sharing 152 // that sharing the style makes sense. Instead we should just not support st yle sharing
153 // for them. 153 // for them.
154 if (element().hasTagName(progressTag)) { 154 if (isHTMLProgressElement(element())) {
155 if (element().shouldAppearIndeterminate() != candidate.shouldAppearIndet erminate()) 155 if (element().shouldAppearIndeterminate() != candidate.shouldAppearIndet erminate())
156 return false; 156 return false;
157 } 157 }
158 158
159 return true; 159 return true;
160 } 160 }
161 161
162 bool SharedStyleFinder::sharingCandidateShadowHasSharedStyleSheetContents(Elemen t& candidate) const 162 bool SharedStyleFinder::sharingCandidateShadowHasSharedStyleSheetContents(Elemen t& candidate) const
163 { 163 {
164 if (!element().shadow() || !element().shadow()->containsActiveStyles()) 164 if (!element().shadow() || !element().shadow()->containsActiveStyles())
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above. 334 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above.
335 if (!SiblingRuleHelper(element().parentElementOrShadowRoot()).childrenSuppor tStyleSharing()) { 335 if (!SiblingRuleHelper(element().parentElementOrShadowRoot()).childrenSuppor tStyleSharing()) {
336 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt); 336 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt);
337 return 0; 337 return 0;
338 } 338 }
339 339
340 return shareElement->renderStyle(); 340 return shareElement->renderStyle();
341 } 341 }
342 342
343 } 343 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.cpp ('k') | Source/core/css/resolver/StyleAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698