OLD | NEW |
---|---|
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, 2007, 2008, 2010 Apple Inc. All rights reserv ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 } | 154 } |
155 | 155 |
156 void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const Atomic String& value) | 156 void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const Atomic String& value) |
157 { | 157 { |
158 if (name == rowsAttr) { | 158 if (name == rowsAttr) { |
159 int rows = 0; | 159 int rows = 0; |
160 if (value.isEmpty() || !parseHTMLInteger(value, rows) || rows <= 0) | 160 if (value.isEmpty() || !parseHTMLInteger(value, rows) || rows <= 0) |
161 rows = defaultRows; | 161 rows = defaultRows; |
162 if (m_rows != rows) { | 162 if (m_rows != rows) { |
163 m_rows = rows; | 163 m_rows = rows; |
164 if (renderer()) | 164 if (layoutObject()) |
165 renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid ation(); | 165 layoutObject()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInv alidation(); |
166 } | 166 } |
167 } else if (name == colsAttr) { | 167 } else if (name == colsAttr) { |
168 int cols = 0; | 168 int cols = 0; |
169 if (value.isEmpty() || !parseHTMLInteger(value, cols) || cols <= 0) | 169 if (value.isEmpty() || !parseHTMLInteger(value, cols) || cols <= 0) |
170 cols = defaultCols; | 170 cols = defaultCols; |
171 if (m_cols != cols) { | 171 if (m_cols != cols) { |
172 m_cols = cols; | 172 m_cols = cols; |
173 if (renderer()) | 173 if (layoutObject()) |
174 renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid ation(); | 174 layoutObject()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInv alidation(); |
Julien - ping for review
2015/03/05 16:19:16
It seems like it could be rewritten (as we're touc
dsinclair
2015/03/05 16:40:02
Done.
| |
175 } | 175 } |
176 } else if (name == wrapAttr) { | 176 } else if (name == wrapAttr) { |
177 // The virtual/physical values were a Netscape extension of HTML 3.0, no w deprecated. | 177 // The virtual/physical values were a Netscape extension of HTML 3.0, no w deprecated. |
178 // The soft/hard /off values are a recommendation for HTML 4 extension b y IE and NS 4. | 178 // The soft/hard /off values are a recommendation for HTML 4 extension b y IE and NS 4. |
179 WrapMethod wrap; | 179 WrapMethod wrap; |
180 if (equalIgnoringCase(value, "physical") || equalIgnoringCase(value, "ha rd") || equalIgnoringCase(value, "on")) | 180 if (equalIgnoringCase(value, "physical") || equalIgnoringCase(value, "ha rd") || equalIgnoringCase(value, "on")) |
181 wrap = HardWrap; | 181 wrap = HardWrap; |
182 else if (equalIgnoringCase(value, "off")) | 182 else if (equalIgnoringCase(value, "off")) |
183 wrap = NoWrap; | 183 wrap = NoWrap; |
184 else | 184 else |
185 wrap = SoftWrap; | 185 wrap = SoftWrap; |
186 if (wrap != m_wrap) { | 186 if (wrap != m_wrap) { |
187 m_wrap = wrap; | 187 m_wrap = wrap; |
188 if (renderer()) | 188 if (layoutObject()) |
189 renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid ation(); | 189 layoutObject()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInv alidation(); |
Julien - ping for review
2015/03/05 16:19:16
Ditto.
dsinclair
2015/03/05 16:40:01
Done.
| |
190 } | 190 } |
191 } else if (name == accesskeyAttr) { | 191 } else if (name == accesskeyAttr) { |
192 // ignore for the moment | 192 // ignore for the moment |
193 } else if (name == maxlengthAttr) { | 193 } else if (name == maxlengthAttr) { |
194 setNeedsValidityCheck(); | 194 setNeedsValidityCheck(); |
195 } else if (name == minlengthAttr) { | 195 } else if (name == minlengthAttr) { |
196 setNeedsValidityCheck(); | 196 setNeedsValidityCheck(); |
197 } else | 197 } else |
198 HTMLTextFormControlElement::parseAttribute(name, value); | 198 HTMLTextFormControlElement::parseAttribute(name, value); |
199 } | 199 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent) ; | 246 setSelectionRange(0, 0, SelectionHasNoDirection, NotDispatchSelectEvent) ; |
247 else | 247 else |
248 restoreCachedSelection(); | 248 restoreCachedSelection(); |
249 | 249 |
250 if (document().frame()) | 250 if (document().frame()) |
251 document().frame()->selection().revealSelection(); | 251 document().frame()->selection().revealSelection(); |
252 } | 252 } |
253 | 253 |
254 void HTMLTextAreaElement::defaultEventHandler(Event* event) | 254 void HTMLTextAreaElement::defaultEventHandler(Event* event) |
255 { | 255 { |
256 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur)) | 256 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || even t->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames::blur )) |
257 forwardEvent(event); | 257 forwardEvent(event); |
258 else if (renderer() && event->isBeforeTextInsertedEvent()) | 258 else if (layoutObject() && event->isBeforeTextInsertedEvent()) |
259 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t)); | 259 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t)); |
260 | 260 |
261 HTMLTextFormControlElement::defaultEventHandler(event); | 261 HTMLTextFormControlElement::defaultEventHandler(event); |
262 } | 262 } |
263 | 263 |
264 void HTMLTextAreaElement::handleFocusEvent(Element*, WebFocusType) | 264 void HTMLTextAreaElement::handleFocusEvent(Element*, WebFocusType) |
265 { | 265 { |
266 if (LocalFrame* frame = document().frame()) | 266 if (LocalFrame* frame = document().frame()) |
267 frame->spellChecker().didBeginEditing(this); | 267 frame->spellChecker().didBeginEditing(this); |
268 } | 268 } |
(...skipping 11 matching lines...) Expand all Loading... | |
280 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check. | 280 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check. |
281 calculateAndAdjustDirectionality(); | 281 calculateAndAdjustDirectionality(); |
282 | 282 |
283 ASSERT(document().isActive()); | 283 ASSERT(document().isActive()); |
284 document().frameHost()->chrome().client().didChangeValueInTextField(*this); | 284 document().frameHost()->chrome().client().didChangeValueInTextField(*this); |
285 } | 285 } |
286 | 286 |
287 void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const | 287 void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const |
288 { | 288 { |
289 ASSERT(event); | 289 ASSERT(event); |
290 ASSERT(renderer()); | 290 ASSERT(layoutObject()); |
291 int signedMaxLength = maxLength(); | 291 int signedMaxLength = maxLength(); |
292 if (signedMaxLength < 0) | 292 if (signedMaxLength < 0) |
293 return; | 293 return; |
294 unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); | 294 unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); |
295 | 295 |
296 const String& currentValue = innerEditorValue(); | 296 const String& currentValue = innerEditorValue(); |
297 unsigned currentLength = computeLengthForSubmission(currentValue); | 297 unsigned currentLength = computeLengthForSubmission(currentValue); |
298 if (currentLength + computeLengthForSubmission(event->text()) < unsignedMaxL ength) | 298 if (currentLength + computeLengthForSubmission(event->text()) < unsignedMaxL ength) |
299 return; | 299 return; |
300 | 300 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 { | 626 { |
627 return true; | 627 return true; |
628 } | 628 } |
629 | 629 |
630 bool HTMLTextAreaElement::supportsAutofocus() const | 630 bool HTMLTextAreaElement::supportsAutofocus() const |
631 { | 631 { |
632 return true; | 632 return true; |
633 } | 633 } |
634 | 634 |
635 } | 635 } |
OLD | NEW |