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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 | 391 |
392 layoutObject->autoscroll(position); | 392 layoutObject->autoscroll(position); |
393 } | 393 } |
394 | 394 |
395 LayoutUnit LayoutTextControlSingleLine::scrollWidth() const | 395 LayoutUnit LayoutTextControlSingleLine::scrollWidth() const |
396 { | 396 { |
397 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { | 397 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { |
398 // Adjust scrollWidth to inculde input element horizontal paddings and | 398 // Adjust scrollWidth to inculde input element horizontal paddings and |
399 // decoration width | 399 // decoration width |
400 LayoutUnit adjustment = clientWidth() - inner->clientWidth(); | 400 LayoutUnit adjustment = clientWidth() - inner->clientWidth(); |
401 // TODO(leviw): We floor to avoid breaking JS that tries to scroll to | 401 return inner->scrollWidth() + adjustment; |
402 // scrollWidth - clientWidth. | |
403 // TODO(leviw): These values are broken when zooming. crbug.com/471412 | |
404 return inner->scrollWidth().floor() + adjustment; | |
405 } | 402 } |
406 return LayoutBlockFlow::scrollWidth(); | 403 return LayoutBlockFlow::scrollWidth(); |
407 } | 404 } |
408 | 405 |
409 LayoutUnit LayoutTextControlSingleLine::scrollHeight() const | 406 LayoutUnit LayoutTextControlSingleLine::scrollHeight() const |
410 { | 407 { |
411 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { | 408 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { |
412 // Adjust scrollHeight to include input element vertical paddings and | 409 // Adjust scrollHeight to include input element vertical paddings and |
413 // decoration height | 410 // decoration height |
414 LayoutUnit adjustment = clientHeight() - inner->clientHeight(); | 411 LayoutUnit adjustment = clientHeight() - inner->clientHeight(); |
415 // TODO(leviw): We floor to avoid breaking JS that tries to scroll to | 412 return inner->scrollHeight() + adjustment; |
416 // scrollHeight - clientHeight. | |
417 // TODO(leviw): These values are broken when zooming. crbug.com/471412 | |
418 return inner->scrollHeight().floor() + adjustment; | |
419 } | 413 } |
420 return LayoutBlockFlow::scrollHeight(); | 414 return LayoutBlockFlow::scrollHeight(); |
421 } | 415 } |
422 | 416 |
423 LayoutUnit LayoutTextControlSingleLine::scrollLeft() const | 417 LayoutUnit LayoutTextControlSingleLine::scrollLeft() const |
424 { | 418 { |
425 if (innerEditorElement()) | 419 if (innerEditorElement()) |
426 return innerEditorElement()->scrollLeft(); | 420 return innerEditorElement()->scrollLeft(); |
427 return LayoutBlockFlow::scrollLeft(); | 421 return LayoutBlockFlow::scrollLeft(); |
428 } | 422 } |
(...skipping 16 matching lines...) Expand all Loading... |
445 if (innerEditorElement()) | 439 if (innerEditorElement()) |
446 innerEditorElement()->setScrollTop(newTop); | 440 innerEditorElement()->setScrollTop(newTop); |
447 } | 441 } |
448 | 442 |
449 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const | 443 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const |
450 { | 444 { |
451 return toHTMLInputElement(node()); | 445 return toHTMLInputElement(node()); |
452 } | 446 } |
453 | 447 |
454 } | 448 } |
OLD | NEW |