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

Side by Side Diff: Source/core/html/HTMLFieldSetElement.cpp

Issue 646273004: Implement :valid and :invalid pseudoclass for <fieldset> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Pull 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/html/HTMLFieldSetElement.h ('k') | Source/core/html/HTMLFormControlElement.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) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void HTMLFieldSetElement::trace(Visitor* visitor) 53 void HTMLFieldSetElement::trace(Visitor* visitor)
54 { 54 {
55 #if ENABLE(OILPAN) 55 #if ENABLE(OILPAN)
56 visitor->trace(m_associatedElements); 56 visitor->trace(m_associatedElements);
57 #endif 57 #endif
58 HTMLFormControlElement::trace(visitor); 58 HTMLFormControlElement::trace(visitor);
59 } 59 }
60 60
61 bool HTMLFieldSetElement::matchesValidityPseudoClasses() const
62 {
63 return true;
64 }
65
66 bool HTMLFieldSetElement::isValidElement()
67 {
68 const FormAssociatedElement::List& elements = associatedElements();
69 for (unsigned i = 0; i < elements.size(); ++i) {
70 ASSERT(elements[i]->isFormControlElement());
tkent 2014/10/21 00:11:13 We should take care of a case that elements[i] is
Bartek Nowierski 2014/10/21 03:25:26 Obviously the assert is incorrect, I don't know wh
71 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i].g et());
72 if (!control->checkValidity(0, CheckValidityDispatchNoEvent))
73 return false;
74 }
75 return true;
76 }
77
78 void HTMLFieldSetElement::setNeedsValidityCheck()
79 {
80 // For now unconditionally order style recalculation, which triggers
81 // validity recalculation. In the near future, consider implement validity
82 // cache and recalculate style only if it changed.
83 // If setNeedsStyleRecalc ends up being called conditionally here, then
84 // the caller will have to call setNeedsValidityCheck for all ancestor
85 // fieldsets, not only the furthest one.
86 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createW ithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid));
87 }
88
61 void HTMLFieldSetElement::invalidateDisabledStateUnder(Element& base) 89 void HTMLFieldSetElement::invalidateDisabledStateUnder(Element& base)
62 { 90 {
63 for (HTMLFormControlElement* element = Traversal<HTMLFormControlElement>::fi rstWithin(base); element; element = Traversal<HTMLFormControlElement>::next(*ele ment, &base)) 91 for (HTMLFormControlElement* element = Traversal<HTMLFormControlElement>::fi rstWithin(base); element; element = Traversal<HTMLFormControlElement>::next(*ele ment, &base))
64 element->ancestorDisabledStateWasChanged(); 92 element->ancestorDisabledStateWasChanged();
65 } 93 }
66 94
67 void HTMLFieldSetElement::disabledAttributeChanged() 95 void HTMLFieldSetElement::disabledAttributeChanged()
68 { 96 {
69 // This element must be updated before the style of nodes in its subtree get s recalculated. 97 // This element must be updated before the style of nodes in its subtree get s recalculated.
70 HTMLFormControlElement::disabledAttributeChanged(); 98 HTMLFormControlElement::disabledAttributeChanged();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 155 }
128 } 156 }
129 157
130 const FormAssociatedElement::List& HTMLFieldSetElement::associatedElements() con st 158 const FormAssociatedElement::List& HTMLFieldSetElement::associatedElements() con st
131 { 159 {
132 refreshElementsIfNeeded(); 160 refreshElementsIfNeeded();
133 return m_associatedElements; 161 return m_associatedElements;
134 } 162 }
135 163
136 } // namespace 164 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFieldSetElement.h ('k') | Source/core/html/HTMLFormControlElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698