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

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

Issue 616443002: Implement :valid and :invalid pseudoclass for <form> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests, apply feedback from Keishi, add support for removing/inserting elements into the … 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
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 bool isControl = candidate.isFormControlElement(); 235 bool isControl = candidate.isFormControlElement();
236 ASSERT(isControl == element().isFormControlElement()); 236 ASSERT(isControl == element().isFormControlElement());
237 if (isControl && !canShareStyleWithControl(candidate)) 237 if (isControl && !canShareStyleWithControl(candidate))
238 return false; 238 return false;
239 239
240 if (isHTMLOptionElement(candidate) && isHTMLOptionElement(element()) 240 if (isHTMLOptionElement(candidate) && isHTMLOptionElement(element())
241 && (toHTMLOptionElement(candidate).selected() != toHTMLOptionElement(ele ment()).selected() 241 && (toHTMLOptionElement(candidate).selected() != toHTMLOptionElement(ele ment()).selected()
242 || toHTMLOptionElement(candidate).spatialNavigationFocused() != toHTMLOp tionElement(element()).spatialNavigationFocused())) 242 || toHTMLOptionElement(candidate).spatialNavigationFocused() != toHTMLOp tionElement(element()).spatialNavigationFocused()))
243 return false; 243 return false;
244 244
245 if (candidate.isValidElement() != element().isValidElement())
keishi 2014/10/03 03:44:13 I think we should check document().containsValidit
Bartek Nowierski 2014/10/03 06:01:33 Done. And I moved this check to the bottom
246 return false;
247
245 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver. 248 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver.
246 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() ) 249 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() )
247 return false; 250 return false;
248 251
249 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( )) 252 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( ))
250 return false; 253 return false;
251 254
252 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment()) 255 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment())
253 return false; 256 return false;
254 257
(...skipping 81 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. 339 // 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()) { 340 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) {
338 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt); 341 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt);
339 return 0; 342 return 0;
340 } 343 }
341 344
342 return shareElement->renderStyle(); 345 return shareElement->renderStyle();
343 } 346 }
344 347
345 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698