| 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, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 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 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 RefPtr<InputType> newType = InputType::create(this, newTypeName); | 421 RefPtr<InputType> newType = InputType::create(this, newTypeName); |
| 422 removeFromRadioButtonGroup(); | 422 removeFromRadioButtonGroup(); |
| 423 | 423 |
| 424 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); | 424 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); |
| 425 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr
ibutes(); | 425 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr
ibutes(); |
| 426 | 426 |
| 427 m_inputType->destroyShadowSubtree(); | 427 m_inputType->destroyShadowSubtree(); |
| 428 | 428 |
| 429 bool wasAttached = attached(); | 429 bool wasAttached = attached(); |
| 430 if (wasAttached) | 430 if (wasAttached) |
| 431 detach(); | 431 destroyRenderTree(); |
| 432 | 432 |
| 433 m_inputType = newType.release(); | 433 m_inputType = newType.release(); |
| 434 if (hasAuthorShadowRoot()) | 434 if (hasAuthorShadowRoot()) |
| 435 m_inputTypeView = InputTypeView::create(this); | 435 m_inputTypeView = InputTypeView::create(this); |
| 436 else | 436 else |
| 437 m_inputTypeView = m_inputType; | 437 m_inputTypeView = m_inputType; |
| 438 m_inputType->createShadowSubtree(); | 438 m_inputType->createShadowSubtree(); |
| 439 | 439 |
| 440 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); | 440 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); |
| 441 if (hasTouchEventHandler != m_hasTouchEventHandler) { | 441 if (hasTouchEventHandler != m_hasTouchEventHandler) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 470 ASSERT(elementData()); | 470 ASSERT(elementData()); |
| 471 if (const Attribute* height = getAttributeItem(heightAttr)) | 471 if (const Attribute* height = getAttributeItem(heightAttr)) |
| 472 attributeChanged(heightAttr, height->value()); | 472 attributeChanged(heightAttr, height->value()); |
| 473 if (const Attribute* width = getAttributeItem(widthAttr)) | 473 if (const Attribute* width = getAttributeItem(widthAttr)) |
| 474 attributeChanged(widthAttr, width->value()); | 474 attributeChanged(widthAttr, width->value()); |
| 475 if (const Attribute* align = getAttributeItem(alignAttr)) | 475 if (const Attribute* align = getAttributeItem(alignAttr)) |
| 476 attributeChanged(alignAttr, align->value()); | 476 attributeChanged(alignAttr, align->value()); |
| 477 } | 477 } |
| 478 | 478 |
| 479 if (wasAttached) { | 479 if (wasAttached) { |
| 480 lazyAttach(); | 480 scheduleRenderTreeCreation(); |
| 481 if (document().focusedElement() == this) | 481 if (document().focusedElement() == this) |
| 482 document().updateFocusAppearanceSoon(true /* restore selection */); | 482 document().updateFocusAppearanceSoon(true /* restore selection */); |
| 483 } | 483 } |
| 484 | 484 |
| 485 setChangedSinceLastFormControlChangeEvent(false); | 485 setChangedSinceLastFormControlChangeEvent(false); |
| 486 | 486 |
| 487 addToRadioButtonGroup(); | 487 addToRadioButtonGroup(); |
| 488 | 488 |
| 489 setNeedsValidityCheck(); | 489 setNeedsValidityCheck(); |
| 490 notifyFormStateChanged(); | 490 notifyFormStateChanged(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // FIXME: ignore for the moment | 692 // FIXME: ignore for the moment |
| 693 } else if (name == onsearchAttr) { | 693 } else if (name == onsearchAttr) { |
| 694 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. | 694 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. |
| 695 setAttributeEventListener(eventNames().searchEvent, createAttributeEvent
Listener(this, name, value)); | 695 setAttributeEventListener(eventNames().searchEvent, createAttributeEvent
Listener(this, name, value)); |
| 696 } else if (name == resultsAttr) { | 696 } else if (name == resultsAttr) { |
| 697 int oldResults = m_maxResults; | 697 int oldResults = m_maxResults; |
| 698 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults
) : -1; | 698 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults
) : -1; |
| 699 // FIXME: Detaching just for maxResults change is not ideal. We should
figure out the right | 699 // FIXME: Detaching just for maxResults change is not ideal. We should
figure out the right |
| 700 // time to relayout for this change. | 700 // time to relayout for this change. |
| 701 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0)
) | 701 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0)
) |
| 702 lazyReattachIfAttached(); | 702 scheduleRenderTreeRecreationIfAttached(); |
| 703 setNeedsStyleRecalc(); | 703 setNeedsStyleRecalc(); |
| 704 UseCounter::count(&document(), UseCounter::ResultsAttribute); | 704 UseCounter::count(&document(), UseCounter::ResultsAttribute); |
| 705 } else if (name == incrementalAttr) { | 705 } else if (name == incrementalAttr) { |
| 706 setNeedsStyleRecalc(); | 706 setNeedsStyleRecalc(); |
| 707 UseCounter::count(&document(), UseCounter::IncrementalAttribute); | 707 UseCounter::count(&document(), UseCounter::IncrementalAttribute); |
| 708 } else if (name == minAttr) { | 708 } else if (name == minAttr) { |
| 709 m_inputTypeView->minOrMaxAttributeChanged(); | 709 m_inputTypeView->minOrMaxAttributeChanged(); |
| 710 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); | 710 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); |
| 711 setNeedsValidityCheck(); | 711 setNeedsValidityCheck(); |
| 712 UseCounter::count(&document(), UseCounter::MinAttribute); | 712 UseCounter::count(&document(), UseCounter::MinAttribute); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 742 UseCounter::count(&document(), UseCounter::ListAttribute); | 742 UseCounter::count(&document(), UseCounter::ListAttribute); |
| 743 } | 743 } |
| 744 #if ENABLE(INPUT_SPEECH) | 744 #if ENABLE(INPUT_SPEECH) |
| 745 else if (name == webkitspeechAttr) { | 745 else if (name == webkitspeechAttr) { |
| 746 if (RuntimeEnabledFeatures::speechInputEnabled() && m_inputType->shouldR
espectSpeechAttribute()) { | 746 if (RuntimeEnabledFeatures::speechInputEnabled() && m_inputType->shouldR
espectSpeechAttribute()) { |
| 747 // This renderer and its children have quite different layouts and | 747 // This renderer and its children have quite different layouts and |
| 748 // styles depending on whether the speech button is visible or | 748 // styles depending on whether the speech button is visible or |
| 749 // not. So we reset the whole thing and recreate to get the right | 749 // not. So we reset the whole thing and recreate to get the right |
| 750 // styles and layout. | 750 // styles and layout. |
| 751 m_inputType->destroyShadowSubtree(); | 751 m_inputType->destroyShadowSubtree(); |
| 752 lazyReattachIfAttached(); | 752 scheduleRenderTreeRecreationIfAttached(); |
| 753 m_inputType->createShadowSubtree(); | 753 m_inputType->createShadowSubtree(); |
| 754 setFormControlValueMatchesRenderer(false); | 754 setFormControlValueMatchesRenderer(false); |
| 755 } | 755 } |
| 756 UseCounter::count(&document(), UseCounter::PrefixedSpeechAttribute); | 756 UseCounter::count(&document(), UseCounter::PrefixedSpeechAttribute); |
| 757 } else if (name == onwebkitspeechchangeAttr) | 757 } else if (name == onwebkitspeechchangeAttr) |
| 758 setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAt
tributeEventListener(this, name, value)); | 758 setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAt
tributeEventListener(this, name, value)); |
| 759 #endif | 759 #endif |
| 760 else if (name == webkitdirectoryAttr) { | 760 else if (name == webkitdirectoryAttr) { |
| 761 HTMLTextFormControlElement::parseAttribute(name, value); | 761 HTMLTextFormControlElement::parseAttribute(name, value); |
| 762 UseCounter::count(&document(), UseCounter::PrefixedDirectoryAttribute); | 762 UseCounter::count(&document(), UseCounter::PrefixedDirectoryAttribute); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 781 bool HTMLInputElement::rendererIsNeeded(const RenderStyle& style) | 781 bool HTMLInputElement::rendererIsNeeded(const RenderStyle& style) |
| 782 { | 782 { |
| 783 return m_inputType->rendererIsNeeded() && HTMLTextFormControlElement::render
erIsNeeded(style); | 783 return m_inputType->rendererIsNeeded() && HTMLTextFormControlElement::render
erIsNeeded(style); |
| 784 } | 784 } |
| 785 | 785 |
| 786 RenderObject* HTMLInputElement::createRenderer(RenderStyle* style) | 786 RenderObject* HTMLInputElement::createRenderer(RenderStyle* style) |
| 787 { | 787 { |
| 788 return m_inputTypeView->createRenderer(style); | 788 return m_inputTypeView->createRenderer(style); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void HTMLInputElement::attach(const AttachContext& context) | 791 void HTMLInputElement::createRenderTree(const AttachContext& context) |
| 792 { | 792 { |
| 793 if (!m_hasType) | 793 if (!m_hasType) |
| 794 updateType(); | 794 updateType(); |
| 795 | 795 |
| 796 HTMLTextFormControlElement::attach(context); | 796 HTMLTextFormControlElement::createRenderTree(context); |
| 797 | 797 |
| 798 m_inputTypeView->attach(); | 798 m_inputTypeView->attach(); |
| 799 m_inputType->countUsage(); | 799 m_inputType->countUsage(); |
| 800 | 800 |
| 801 if (document().focusedElement() == this) | 801 if (document().focusedElement() == this) |
| 802 document().updateFocusAppearanceSoon(true /* restore selection */); | 802 document().updateFocusAppearanceSoon(true /* restore selection */); |
| 803 } | 803 } |
| 804 | 804 |
| 805 void HTMLInputElement::detach(const AttachContext& context) | 805 void HTMLInputElement::destroyRenderTree(const AttachContext& context) |
| 806 { | 806 { |
| 807 HTMLTextFormControlElement::detach(context); | 807 HTMLTextFormControlElement::destroyRenderTree(context); |
| 808 setFormControlValueMatchesRenderer(false); | 808 setFormControlValueMatchesRenderer(false); |
| 809 m_inputType->detach(); | 809 m_inputType->detach(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 String HTMLInputElement::altText() const | 812 String HTMLInputElement::altText() const |
| 813 { | 813 { |
| 814 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen | 814 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen |
| 815 // also heavily discussed by Hixie on bugzilla | 815 // also heavily discussed by Hixie on bugzilla |
| 816 // note this is intentionally different to HTMLImageElement::altText() | 816 // note this is intentionally different to HTMLImageElement::altText() |
| 817 String alt = fastGetAttribute(altAttr); | 817 String alt = fastGetAttribute(altAttr); |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 } | 1879 } |
| 1880 | 1880 |
| 1881 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) | 1881 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) |
| 1882 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() | 1882 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() |
| 1883 { | 1883 { |
| 1884 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1884 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
| 1885 } | 1885 } |
| 1886 #endif | 1886 #endif |
| 1887 | 1887 |
| 1888 } // namespace | 1888 } // namespace |
| OLD | NEW |