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

Side by Side Diff: third_party/WebKit/Source/core/html/ClassList.cpp

Issue 2895903002: DOMTokenList: Update serialization algorithm on add()/remove() (Closed)
Patch Set: Apply review comments Created 3 years, 7 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 DCHECK(element_->HasClass()); 53 DCHECK(element_->HasClass());
54 if (element_->GetDocument().InQuirksMode()) { 54 if (element_->GetDocument().InQuirksMode()) {
55 if (!class_names_for_quirks_mode_) 55 if (!class_names_for_quirks_mode_)
56 class_names_for_quirks_mode_ = WTF::WrapUnique( 56 class_names_for_quirks_mode_ = WTF::WrapUnique(
57 new SpaceSplitString(value(), SpaceSplitString::kShouldNotFoldCase)); 57 new SpaceSplitString(value(), SpaceSplitString::kShouldNotFoldCase));
58 return *class_names_for_quirks_mode_.get(); 58 return *class_names_for_quirks_mode_.get();
59 } 59 }
60 return element_->ClassNames(); 60 return element_->ClassNames();
61 } 61 }
62 62
63 SpaceSplitString& ClassList::MutableSet() {
64 // We can't mutate element_->ClassNames() because it is used to compare class
65 // names before/after class attribute change.
66 if (element_->HasClass())
67 mutable_set_ = ClassNames();
68 else
69 mutable_set_ = SpaceSplitString();
70 return mutable_set_;
71 }
72
63 DEFINE_TRACE(ClassList) { 73 DEFINE_TRACE(ClassList) {
64 visitor->Trace(element_); 74 visitor->Trace(element_);
65 DOMTokenList::Trace(visitor); 75 DOMTokenList::Trace(visitor);
66 } 76 }
67 77
68 } // namespace blink 78 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ClassList.h ('k') | third_party/WebKit/Source/core/html/RelList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698