/* * Copyright (C) 2010 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "third_party/blink/renderer/core/dom/dom_token_list.h" #include "base/auto_reset.h" #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" namespace blink { namespace { bool CheckEmptyToken(const String& token, ExceptionState& exception_state) { … } bool CheckTokenWithWhitespace(const String& token, ExceptionState& exception_state) { … } // This implements the common part of the following operations: // https://dom.spec.whatwg.org/#dom-domtokenlist-add // https://dom.spec.whatwg.org/#dom-domtokenlist-remove // https://dom.spec.whatwg.org/#dom-domtokenlist-toggle // https://dom.spec.whatwg.org/#dom-domtokenlist-replace bool CheckTokenSyntax(const String& token, ExceptionState& exception_state) { … } bool CheckTokensSyntax(const Vector<String>& tokens, ExceptionState& exception_state) { … } } // anonymous namespace void DOMTokenList::Trace(Visitor* visitor) const { … } // https://dom.spec.whatwg.org/#concept-domtokenlist-validation bool DOMTokenList::ValidateTokenValue(const AtomicString&, ExceptionState& exception_state) const { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-contains bool DOMTokenList::contains(const AtomicString& token) const { … } void DOMTokenList::Add(const AtomicString& token) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-add // Optimally, this should take a Vector<AtomicString> const ref in argument but // the bindings generator does not handle that. void DOMTokenList::add(const Vector<String>& tokens, ExceptionState& exception_state) { … } void DOMTokenList::Remove(const AtomicString& token) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-remove // Optimally, this should take a Vector<AtomicString> const ref in argument but // the bindings generator does not handle that. void DOMTokenList::remove(const Vector<String>& tokens, ExceptionState& exception_state) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-toggle bool DOMTokenList::toggle(const AtomicString& token, ExceptionState& exception_state) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-toggle bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionState& exception_state) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-replace bool DOMTokenList::replace(const AtomicString& token, const AtomicString& new_token, ExceptionState& exception_state) { … } bool DOMTokenList::supports(const AtomicString& token, ExceptionState& exception_state) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-add void DOMTokenList::AddTokens(const Vector<String>& tokens) { … } // https://dom.spec.whatwg.org/#dom-domtokenlist-remove void DOMTokenList::RemoveTokens(const Vector<String>& tokens) { … } // https://dom.spec.whatwg.org/#concept-dtl-update void DOMTokenList::UpdateWithTokenSet(const SpaceSplitString& token_set) { … } AtomicString DOMTokenList::value() const { … } void DOMTokenList::setValue(const AtomicString& value) { … } void DOMTokenList::DidUpdateAttributeValue(const AtomicString& old_value, const AtomicString& new_value) { … } const AtomicString DOMTokenList::item(unsigned index) const { … } } // namespace blink