Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1390)

Side by Side Diff: Source/core/layout/LayoutTextControlSingleLine.cpp

Issue 1223173006: Get rid of clampScrollOffset and make maximumScrollPosition sane. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert changes to Element::clientWidth, etc. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/paint/DeprecatedPaintLayerScrollableArea.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/core/paint/DeprecatedPaintLayerScrollableArea.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698