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

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 & merge 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) 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 RefPtrWillBeRawPtr<HTMLFieldSetElement> protector(this);
tkent 2014/10/19 23:56:40 This variable is not needed. It would be needed if
Bartek Nowierski 2014/10/20 10:43:10 Done.
69 const FormAssociatedElement::List& elements = associatedElements();
70 for (unsigned i = 0; i < elements.size(); ++i) {
71 ASSERT(elements[i]->isFormControlElement());
72 HTMLFormControlElement* control = toHTMLFormControlElement(elements[i].g et());
73 if (!control->checkValidity(0, CheckValidityDispatchNoEvent))
74 return false;
75 }
76 return true;
77 }
78
79 void HTMLFieldSetElement::setNeedsValidityCheck()
80 {
81 // For now unconditionally order style recalculation, which triggers
82 // validity recalculation. In the near future, consider implement validity
83 // cache and recalculate style only if it changed.
84 // If setNeedsStyleRecalc ends up being called conditionally here, then
85 // the caller will have to call setNeedsValidityCheck for all ancestor
86 // fieldsets, not only the furthest one.
87 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createW ithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid));
88 }
89
61 void HTMLFieldSetElement::invalidateDisabledStateUnder(Element& base) 90 void HTMLFieldSetElement::invalidateDisabledStateUnder(Element& base)
62 { 91 {
63 for (HTMLFormControlElement* element = Traversal<HTMLFormControlElement>::fi rstWithin(base); element; element = Traversal<HTMLFormControlElement>::next(*ele ment, &base)) 92 for (HTMLFormControlElement* element = Traversal<HTMLFormControlElement>::fi rstWithin(base); element; element = Traversal<HTMLFormControlElement>::next(*ele ment, &base))
64 element->ancestorDisabledStateWasChanged(); 93 element->ancestorDisabledStateWasChanged();
65 } 94 }
66 95
67 void HTMLFieldSetElement::disabledAttributeChanged() 96 void HTMLFieldSetElement::disabledAttributeChanged()
68 { 97 {
69 // This element must be updated before the style of nodes in its subtree get s recalculated. 98 // This element must be updated before the style of nodes in its subtree get s recalculated.
70 HTMLFormControlElement::disabledAttributeChanged(); 99 HTMLFormControlElement::disabledAttributeChanged();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 156 }
128 } 157 }
129 158
130 const FormAssociatedElement::List& HTMLFieldSetElement::associatedElements() con st 159 const FormAssociatedElement::List& HTMLFieldSetElement::associatedElements() con st
131 { 160 {
132 refreshElementsIfNeeded(); 161 refreshElementsIfNeeded();
133 return m_associatedElements; 162 return m_associatedElements;
134 } 163 }
135 164
136 } // namespace 165 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698