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

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

Issue 178253006: Output Element defaultValue should be based on textContent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 void HTMLOutputElement::setValue(const String& value) 112 void HTMLOutputElement::setValue(const String& value)
113 { 113 {
114 // The value mode flag set to "value" when the value attribute is set. 114 // The value mode flag set to "value" when the value attribute is set.
115 m_isDefaultValueMode = false; 115 m_isDefaultValueMode = false;
116 if (value == this->value()) 116 if (value == this->value())
117 return; 117 return;
118 setTextContentInternal(value); 118 setTextContentInternal(value);
119 } 119 }
120 120
121 String HTMLOutputElement::defaultValue() const 121 String HTMLOutputElement::defaultValue()
122 { 122 {
123 if (m_isDefaultValueMode && m_defaultValue != value())
124 setDefaultValue(value());
123 return m_defaultValue; 125 return m_defaultValue;
124 } 126 }
125 127
126 void HTMLOutputElement::setDefaultValue(const String& value) 128 void HTMLOutputElement::setDefaultValue(const String& value)
127 { 129 {
128 if (m_defaultValue == value) 130 if (m_defaultValue == value)
129 return; 131 return;
130 m_defaultValue = value; 132 m_defaultValue = value;
131 // The spec requires the value attribute set to the default value 133 // The spec requires the value attribute set to the default value
132 // when the element's value mode flag to "default". 134 // when the element's value mode flag to "default".
133 if (m_isDefaultValueMode) 135 if (m_isDefaultValueMode)
134 setTextContentInternal(value); 136 setTextContentInternal(value);
135 } 137 }
136 138
137 void HTMLOutputElement::setTextContentInternal(const String& value) 139 void HTMLOutputElement::setTextContentInternal(const String& value)
138 { 140 {
139 ASSERT(!m_isSetTextContentInProgress); 141 ASSERT(!m_isSetTextContentInProgress);
140 m_isSetTextContentInProgress = true; 142 m_isSetTextContentInProgress = true;
141 setTextContent(value); 143 setTextContent(value);
142 } 144 }
143 145
144 } // namespace 146 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698