| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 } | 220 } |
| 221 | 221 |
| 222 void TextFieldInputType::forwardEvent(Event* event) | 222 void TextFieldInputType::forwardEvent(Event* event) |
| 223 { | 223 { |
| 224 if (SpinButtonElement* spinButton = spinButtonElement()) { | 224 if (SpinButtonElement* spinButton = spinButtonElement()) { |
| 225 spinButton->forwardEvent(event); | 225 spinButton->forwardEvent(event); |
| 226 if (event->defaultHandled()) | 226 if (event->defaultHandled()) |
| 227 return; | 227 return; |
| 228 } | 228 } |
| 229 | 229 |
| 230 if (element().renderer() && (event->isMouseEvent() || event->isDragEvent() |
| event->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeNames
::blur || event->type() == EventTypeNames::focus)) { | 230 if (element().layoutObject() && (event->isMouseEvent() || event->isDragEvent
() || event->hasInterface(EventNames::WheelEvent) || event->type() == EventTypeN
ames::blur || event->type() == EventTypeNames::focus)) { |
| 231 LayoutTextControlSingleLine* renderTextControl = toLayoutTextControlSing
leLine(element().renderer()); | 231 LayoutTextControlSingleLine* renderTextControl = toLayoutTextControlSing
leLine(element().layoutObject()); |
| 232 if (event->type() == EventTypeNames::blur) { | 232 if (event->type() == EventTypeNames::blur) { |
| 233 if (LayoutBox* innerEditorRenderer = element().innerEditorElement()-
>layoutBox()) { | 233 if (LayoutBox* innerEditorRenderer = element().innerEditorElement()-
>layoutBox()) { |
| 234 // FIXME: This class has no need to know about Layer! | 234 // FIXME: This class has no need to know about Layer! |
| 235 if (Layer* innerLayer = innerEditorRenderer->layer()) { | 235 if (Layer* innerLayer = innerEditorRenderer->layer()) { |
| 236 if (LayerScrollableArea* innerScrollableArea = innerLayer->s
crollableArea()) { | 236 if (LayerScrollableArea* innerScrollableArea = innerLayer->s
crollableArea()) { |
| 237 IntSize scrollOffset(!renderTextControl->style()->isLeft
ToRightDirection() ? innerScrollableArea->scrollWidth().toInt() : 0, 0); | 237 IntSize scrollOffset(!renderTextControl->style()->isLeft
ToRightDirection() ? innerScrollableArea->scrollWidth().toInt() : 0, 0); |
| 238 innerScrollableArea->scrollToOffset(scrollOffset, Scroll
OffsetClamped); | 238 innerScrollableArea->scrollToOffset(scrollOffset, Scroll
OffsetClamped); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 return true; | 477 return true; |
| 478 } | 478 } |
| 479 | 479 |
| 480 String TextFieldInputType::convertFromVisibleValue(const String& visibleValue) c
onst | 480 String TextFieldInputType::convertFromVisibleValue(const String& visibleValue) c
onst |
| 481 { | 481 { |
| 482 return visibleValue; | 482 return visibleValue; |
| 483 } | 483 } |
| 484 | 484 |
| 485 void TextFieldInputType::subtreeHasChanged() | 485 void TextFieldInputType::subtreeHasChanged() |
| 486 { | 486 { |
| 487 ASSERT(element().renderer()); | 487 ASSERT(element().layoutObject()); |
| 488 | 488 |
| 489 bool wasChanged = element().wasChangedSinceLastFormControlChangeEvent(); | 489 bool wasChanged = element().wasChangedSinceLastFormControlChangeEvent(); |
| 490 element().setChangedSinceLastFormControlChangeEvent(true); | 490 element().setChangedSinceLastFormControlChangeEvent(true); |
| 491 | 491 |
| 492 // We don't need to call sanitizeUserInputValue() function here because | 492 // We don't need to call sanitizeUserInputValue() function here because |
| 493 // HTMLInputElement::handleBeforeTextInsertedEvent() has already called | 493 // HTMLInputElement::handleBeforeTextInsertedEvent() has already called |
| 494 // sanitizeUserInputValue(). | 494 // sanitizeUserInputValue(). |
| 495 // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextIn
sertedEvent. | 495 // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextIn
sertedEvent. |
| 496 element().setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element
().innerEditorValue()))); | 496 element().setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element
().innerEditorValue()))); |
| 497 element().updatePlaceholderVisibility(false); | 497 element().updatePlaceholderVisibility(false); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 553 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
| 554 } | 554 } |
| 555 | 555 |
| 556 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) | 556 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) |
| 557 { | 557 { |
| 558 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 558 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
| 559 element().dispatchFormControlChangeEvent(); | 559 element().dispatchFormControlChangeEvent(); |
| 560 } | 560 } |
| 561 | 561 |
| 562 } // namespace blink | 562 } // namespace blink |
| OLD | NEW |