OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. |
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 RenderObject* innerTextRenderer = innerTextElement()->renderer(); | 246 RenderObject* innerTextRenderer = innerTextElement()->renderer(); |
247 if (innerTextRenderer && diff == StyleDifferenceLayout) | 247 if (innerTextRenderer && diff == StyleDifferenceLayout) |
248 innerTextRenderer->setNeedsLayout(); | 248 innerTextRenderer->setNeedsLayout(); |
249 if (HTMLElement* placeholder = inputElement()->placeholderElement()) | 249 if (HTMLElement* placeholder = inputElement()->placeholderElement()) |
250 placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldB
eTruncated() ? CSSValueEllipsis : CSSValueClip); | 250 placeholder->setInlineStyleProperty(CSSPropertyTextOverflow, textShouldB
eTruncated() ? CSSValueEllipsis : CSSValueClip); |
251 setHasOverflowClip(false); | 251 setHasOverflowClip(false); |
252 } | 252 } |
253 | 253 |
254 void RenderTextControlSingleLine::capsLockStateMayHaveChanged() | 254 void RenderTextControlSingleLine::capsLockStateMayHaveChanged() |
255 { | 255 { |
256 if (!node() || !document()) | 256 if (!node()) |
257 return; | 257 return; |
258 | 258 |
259 // Only draw the caps lock indicator if these things are true: | 259 // Only draw the caps lock indicator if these things are true: |
260 // 1) The field is a password field | 260 // 1) The field is a password field |
261 // 2) The frame is active | 261 // 2) The frame is active |
262 // 3) The element is focused | 262 // 3) The element is focused |
263 // 4) The caps lock is on | 263 // 4) The caps lock is on |
264 bool shouldDrawCapsLockIndicator = false; | 264 bool shouldDrawCapsLockIndicator = false; |
265 | 265 |
266 if (Frame* frame = document()->frame()) | 266 if (Frame* frame = document().frame()) |
267 shouldDrawCapsLockIndicator = inputElement()->isPasswordField() && frame
->selection()->isFocusedAndActive() && document()->focusedElement() == node() &&
PlatformKeyboardEvent::currentCapsLockState(); | 267 shouldDrawCapsLockIndicator = inputElement()->isPasswordField() && frame
->selection()->isFocusedAndActive() && document().focusedElement() == node() &&
PlatformKeyboardEvent::currentCapsLockState(); |
268 | 268 |
269 if (shouldDrawCapsLockIndicator != m_shouldDrawCapsLockIndicator) { | 269 if (shouldDrawCapsLockIndicator != m_shouldDrawCapsLockIndicator) { |
270 m_shouldDrawCapsLockIndicator = shouldDrawCapsLockIndicator; | 270 m_shouldDrawCapsLockIndicator = shouldDrawCapsLockIndicator; |
271 repaint(); | 271 repaint(); |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
275 bool RenderTextControlSingleLine::hasControlClip() const | 275 bool RenderTextControlSingleLine::hasControlClip() const |
276 { | 276 { |
277 // Apply control clip for text fields with decorations. | 277 // Apply control clip for text fields with decorations. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta
lLine, PositionOfInteriorLineBoxes)) | 365 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta
lLine, PositionOfInteriorLineBoxes)) |
366 textBlockStyle->setLineHeight(RenderStyle::initialLineHeight()); | 366 textBlockStyle->setLineHeight(RenderStyle::initialLineHeight()); |
367 | 367 |
368 textBlockStyle->setDisplay(BLOCK); | 368 textBlockStyle->setDisplay(BLOCK); |
369 | 369 |
370 return textBlockStyle.release(); | 370 return textBlockStyle.release(); |
371 } | 371 } |
372 | 372 |
373 bool RenderTextControlSingleLine::textShouldBeTruncated() const | 373 bool RenderTextControlSingleLine::textShouldBeTruncated() const |
374 { | 374 { |
375 return document()->focusedElement() != node() && style()->textOverflow() ==
TextOverflowEllipsis; | 375 return document().focusedElement() != node() && style()->textOverflow() == T
extOverflowEllipsis; |
376 } | 376 } |
377 | 377 |
378 void RenderTextControlSingleLine::autoscroll(const IntPoint& position) | 378 void RenderTextControlSingleLine::autoscroll(const IntPoint& position) |
379 { | 379 { |
380 RenderBox* renderer = innerTextElement()->renderBox(); | 380 RenderBox* renderer = innerTextElement()->renderBox(); |
381 if (!renderer) | 381 if (!renderer) |
382 return; | 382 return; |
383 RenderLayer* layer = renderer->layer(); | 383 RenderLayer* layer = renderer->layer(); |
384 if (layer) | 384 if (layer) |
385 layer->autoscroll(position); | 385 layer->autoscroll(position); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (innerTextElement()) | 424 if (innerTextElement()) |
425 innerTextElement()->setScrollTop(newTop); | 425 innerTextElement()->setScrollTop(newTop); |
426 } | 426 } |
427 | 427 |
428 HTMLInputElement* RenderTextControlSingleLine::inputElement() const | 428 HTMLInputElement* RenderTextControlSingleLine::inputElement() const |
429 { | 429 { |
430 return toHTMLInputElement(node()); | 430 return toHTMLInputElement(node()); |
431 } | 431 } |
432 | 432 |
433 } | 433 } |
OLD | NEW |