| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 setPlaceholderVisibility(placeholderShouldBeVisible()); | 167 setPlaceholderVisibility(placeholderShouldBeVisible()); |
| 168 if (placeHolderWasVisible == isPlaceholderVisible()) | 168 if (placeHolderWasVisible == isPlaceholderVisible()) |
| 169 return; | 169 return; |
| 170 | 170 |
| 171 pseudoStateChanged(CSSSelector::PseudoPlaceholderShown); | 171 pseudoStateChanged(CSSSelector::PseudoPlaceholderShown); |
| 172 placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible
() ? CSSValueBlock : CSSValueNone, true); | 172 placeholder->setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible
() ? CSSValueBlock : CSSValueNone, true); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void HTMLTextFormControlElement::setSelectionStart(int start) | 175 void HTMLTextFormControlElement::setSelectionStart(int start) |
| 176 { | 176 { |
| 177 setSelectionRange(start, std::max(start, selectionEnd()), selectionDirection
()); | 177 setSelectionRangeForBinding(start, std::max(start, selectionEnd()), selectio
nDirection()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void HTMLTextFormControlElement::setSelectionEnd(int end) | 180 void HTMLTextFormControlElement::setSelectionEnd(int end) |
| 181 { | 181 { |
| 182 setSelectionRange(std::min(end, selectionStart()), end, selectionDirection()
); | 182 setSelectionRangeForBinding(std::min(end, selectionStart()), end, selectionD
irection()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void HTMLTextFormControlElement::setSelectionDirection(const String& direction) | 185 void HTMLTextFormControlElement::setSelectionDirection(const String& direction) |
| 186 { | 186 { |
| 187 setSelectionRange(selectionStart(), selectionEnd(), direction); | 187 setSelectionRangeForBinding(selectionStart(), selectionEnd(), direction); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void HTMLTextFormControlElement::select(NeedToDispatchSelectEvent eventBehaviour
) | 190 void HTMLTextFormControlElement::select(NeedToDispatchSelectEvent eventBehaviour
) |
| 191 { | 191 { |
| 192 setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirectio
n, eventBehaviour); | 192 setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirectio
n, eventBehaviour); |
| 193 focus(); | 193 focus(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol
dValue, String& newValue) | 196 bool HTMLTextFormControlElement::shouldDispatchFormControlChangeEvent(String& ol
dValue, String& newValue) |
| 197 { | 197 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 if (newSelectionEnd > end) | 257 if (newSelectionEnd > end) |
| 258 newSelectionEnd += delta; | 258 newSelectionEnd += delta; |
| 259 else if (newSelectionEnd > start) | 259 else if (newSelectionEnd > start) |
| 260 newSelectionEnd = start + replacementLength; | 260 newSelectionEnd = start + replacementLength; |
| 261 } | 261 } |
| 262 | 262 |
| 263 setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirectio
n); | 263 setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirectio
n); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void HTMLTextFormControlElement::setSelectionRange(int start, int end, const Str
ing& directionString) | 266 void HTMLTextFormControlElement::setSelectionRangeForBinding(int start, int end,
const String& directionString) |
| 267 { | 267 { |
| 268 TextFieldSelectionDirection direction = SelectionHasNoDirection; | 268 TextFieldSelectionDirection direction = SelectionHasNoDirection; |
| 269 if (directionString == "forward") | 269 if (directionString == "forward") |
| 270 direction = SelectionHasForwardDirection; | 270 direction = SelectionHasForwardDirection; |
| 271 else if (directionString == "backward") | 271 else if (directionString == "backward") |
| 272 direction = SelectionHasBackwardDirection; | 272 direction = SelectionHasBackwardDirection; |
| 273 | 273 |
| 274 if (direction == SelectionHasNoDirection && document().frame() && document()
.frame()->editor().behavior().shouldConsiderSelectionAsDirectional()) | 274 if (direction == SelectionHasNoDirection && document().frame() && document()
.frame()->editor().behavior().shouldConsiderSelectionAsDirectional()) |
| 275 direction = SelectionHasForwardDirection; | 275 direction = SelectionHasForwardDirection; |
| 276 | 276 |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) | 1026 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) |
| 1027 { | 1027 { |
| 1028 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); | 1028 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); |
| 1029 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1029 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1030 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1030 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 } // namespace blink | 1033 } // namespace blink |
| OLD | NEW |