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

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

Issue 646543004: Implement :valid and :invalid pseudoclass for <form> (resubmitting) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reorder matchesValidityPseudoClasses() Created 6 years, 2 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 | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/dom/Element.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) 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 if (candidate.isDefaultButtonForForm() != element().isDefaultButtonForForm() ) 78 if (candidate.isDefaultButtonForForm() != element().isDefaultButtonForForm() )
79 return false; 79 return false;
80 80
81 if (document().containsValidityStyleRules()) { 81 if (document().containsValidityStyleRules()) {
82 bool willValidate = candidate.willValidate(); 82 bool willValidate = candidate.willValidate();
83 83
84 if (willValidate != element().willValidate()) 84 if (willValidate != element().willValidate())
85 return false; 85 return false;
86 86
87 if (willValidate && (candidate.isValidFormControlElement() != element(). isValidFormControlElement())) 87 if (willValidate && (candidate.isValidElement() != element().isValidElem ent()))
88 return false; 88 return false;
89 89
90 if (candidate.isInRange() != element().isInRange()) 90 if (candidate.isInRange() != element().isInRange())
91 return false; 91 return false;
92 92
93 if (candidate.isOutOfRange() != element().isOutOfRange()) 93 if (candidate.isOutOfRange() != element().isOutOfRange())
94 return false; 94 return false;
95 } 95 }
96 96
97 return true; 97 return true;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 if (parent->inlineStyle()) 258 if (parent->inlineStyle())
259 return false; 259 return false;
260 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties()) 260 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties())
261 return false; 261 return false;
262 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution())) 262 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution()))
263 return false; 263 return false;
264 if (!parent->childrenSupportStyleSharing()) 264 if (!parent->childrenSupportStyleSharing())
265 return false; 265 return false;
266 } 266 }
267 267
268 if (document().containsValidityStyleRules()) {
269 if (candidate.isValidElement() != element().isValidElement())
270 return false;
271 }
272
268 return true; 273 return true;
269 } 274 }
270 275
271 bool SharedStyleFinder::documentContainsValidCandidate() const 276 bool SharedStyleFinder::documentContainsValidCandidate() const
272 { 277 {
273 for (Element* element = document().documentElement(); element; element = Ele mentTraversal::next(*element)) { 278 for (Element* element = document().documentElement(); element; element = Ele mentTraversal::next(*element)) {
274 if (element->supportsStyleSharing() && canShareStyleWithElement(*element )) 279 if (element->supportsStyleSharing() && canShareStyleWithElement(*element ))
275 return true; 280 return true;
276 } 281 }
277 return false; 282 return false;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above. 341 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above.
337 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { 342 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) {
338 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt); 343 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt);
339 return 0; 344 return 0;
340 } 345 }
341 346
342 return shareElement->renderStyle(); 347 return shareElement->renderStyle();
343 } 348 }
344 349
345 } 350 }
OLDNEW
« no previous file with comments | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698