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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 541 |
542 offset += length; | 542 offset += length; |
543 } | 543 } |
544 | 544 |
545 if (!startNode || !endNode) | 545 if (!startNode || !endNode) |
546 return nullptr; | 546 return nullptr; |
547 | 547 |
548 return Range::create(document(), startNode, start, endNode, end); | 548 return Range::create(document(), startNode, start, endNode, end); |
549 } | 549 } |
550 | 550 |
| 551 const AtomicString& HTMLTextFormControlElement::autocapitalize() const |
| 552 { |
| 553 DEFINE_STATIC_LOCAL(const AtomicString, off, ("off", AtomicString::Construct
FromLiteral)); |
| 554 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString::Constru
ctFromLiteral)); |
| 555 DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters", AtomicStr
ing::ConstructFromLiteral)); |
| 556 DEFINE_STATIC_LOCAL(const AtomicString, words, ("words", AtomicString::Const
ructFromLiteral)); |
| 557 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences", AtomicStrin
g::ConstructFromLiteral)); |
| 558 |
| 559 const AtomicString& value = fastGetAttribute(autocapitalizeAttr); |
| 560 if (equalIgnoringCase(value, none) || equalIgnoringCase(value, off)) |
| 561 return none; |
| 562 if (equalIgnoringCase(value, characters)) |
| 563 return characters; |
| 564 if (equalIgnoringCase(value, words)) |
| 565 return words; |
| 566 if (equalIgnoringCase(value, sentences)) |
| 567 return sentences; |
| 568 |
| 569 // Invalid or missing value. |
| 570 return defaultAutocapitalize(); |
| 571 } |
| 572 |
| 573 void HTMLTextFormControlElement::setAutocapitalize(const AtomicString& autocapit
alize) |
| 574 { |
| 575 setAttribute(autocapitalizeAttr, autocapitalize); |
| 576 } |
| 577 |
551 void HTMLTextFormControlElement::restoreCachedSelection() | 578 void HTMLTextFormControlElement::restoreCachedSelection() |
552 { | 579 { |
553 setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, m_cachedSele
ctionDirection, NotDispatchSelectEvent); | 580 setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, m_cachedSele
ctionDirection, NotDispatchSelectEvent); |
554 } | 581 } |
555 | 582 |
556 void HTMLTextFormControlElement::selectionChanged(bool userTriggered) | 583 void HTMLTextFormControlElement::selectionChanged(bool userTriggered) |
557 { | 584 { |
558 if (!layoutObject() || !isTextFormControl()) | 585 if (!layoutObject() || !isTextFormControl()) |
559 return; | 586 return; |
560 | 587 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 1004 } |
978 | 1005 |
979 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) | 1006 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) |
980 { | 1007 { |
981 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); | 1008 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); |
982 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1009 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
983 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1010 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
984 } | 1011 } |
985 | 1012 |
986 } // namespace blink | 1013 } // namespace blink |
OLD | NEW |