| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 renderer->autoscroll(position); | 384 renderer->autoscroll(position); |
| 385 } | 385 } |
| 386 | 386 |
| 387 LayoutUnit LayoutTextControlSingleLine::scrollWidth() const | 387 LayoutUnit LayoutTextControlSingleLine::scrollWidth() const |
| 388 { | 388 { |
| 389 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { | 389 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { |
| 390 // Adjust scrollWidth to inculde input element horizontal paddings and | 390 // Adjust scrollWidth to inculde input element horizontal paddings and |
| 391 // decoration width | 391 // decoration width |
| 392 LayoutUnit adjustment = clientWidth() - inner->clientWidth(); | 392 LayoutUnit adjustment = clientWidth() - inner->clientWidth(); |
| 393 return innerEditorElement()->scrollWidth() + adjustment; | 393 // TODO(leviw): We floor to avoid breaking JS that tries to scroll to |
| 394 // scrollWidth - clientWidth. |
| 395 // TODO(leviw): These values are broken when zooming. crbug.com/471412 |
| 396 return inner->scrollWidth().floor() + adjustment; |
| 394 } | 397 } |
| 395 return LayoutBlockFlow::scrollWidth(); | 398 return LayoutBlockFlow::scrollWidth(); |
| 396 } | 399 } |
| 397 | 400 |
| 398 LayoutUnit LayoutTextControlSingleLine::scrollHeight() const | 401 LayoutUnit LayoutTextControlSingleLine::scrollHeight() const |
| 399 { | 402 { |
| 400 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { | 403 if (LayoutBox* inner = innerEditorElement() ? innerEditorElement()->layoutBo
x() : 0) { |
| 401 // Adjust scrollHeight to include input element vertical paddings and | 404 // Adjust scrollHeight to include input element vertical paddings and |
| 402 // decoration height | 405 // decoration height |
| 403 LayoutUnit adjustment = clientHeight() - inner->clientHeight(); | 406 LayoutUnit adjustment = clientHeight() - inner->clientHeight(); |
| 404 return innerEditorElement()->scrollHeight() + adjustment; | 407 // TODO(leviw): We floor to avoid breaking JS that tries to scroll to |
| 408 // scrollHeight - clientHeight. |
| 409 // TODO(leviw): These values are broken when zooming. crbug.com/471412 |
| 410 return inner->scrollHeight().floor() + adjustment; |
| 405 } | 411 } |
| 406 return LayoutBlockFlow::scrollHeight(); | 412 return LayoutBlockFlow::scrollHeight(); |
| 407 } | 413 } |
| 408 | 414 |
| 409 LayoutUnit LayoutTextControlSingleLine::scrollLeft() const | 415 LayoutUnit LayoutTextControlSingleLine::scrollLeft() const |
| 410 { | 416 { |
| 411 if (innerEditorElement()) | 417 if (innerEditorElement()) |
| 412 return innerEditorElement()->scrollLeft(); | 418 return innerEditorElement()->scrollLeft(); |
| 413 return LayoutBlockFlow::scrollLeft(); | 419 return LayoutBlockFlow::scrollLeft(); |
| 414 } | 420 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 431 if (innerEditorElement()) | 437 if (innerEditorElement()) |
| 432 innerEditorElement()->setScrollTop(newTop); | 438 innerEditorElement()->setScrollTop(newTop); |
| 433 } | 439 } |
| 434 | 440 |
| 435 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const | 441 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const |
| 436 { | 442 { |
| 437 return toHTMLInputElement(node()); | 443 return toHTMLInputElement(node()); |
| 438 } | 444 } |
| 439 | 445 |
| 440 } | 446 } |
| OLD | NEW |