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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2074353002: The element's offset isn't relevant when comparing its dimensions with that of its overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@621359
Patch Set: bug 619509 Created 4 years, 5 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
OLDNEW
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return m_frameRect.width() - borderLeft() - borderRight() - verticalScrollba rWidth(); 443 return m_frameRect.width() - borderLeft() - borderRight() - verticalScrollba rWidth();
444 } 444 }
445 445
446 LayoutUnit LayoutBox::clientHeight() const 446 LayoutUnit LayoutBox::clientHeight() const
447 { 447 {
448 return m_frameRect.height() - borderTop() - borderBottom() - horizontalScrol lbarHeight(); 448 return m_frameRect.height() - borderTop() - borderBottom() - horizontalScrol lbarHeight();
449 } 449 }
450 450
451 int LayoutBox::pixelSnappedClientWidth() const 451 int LayoutBox::pixelSnappedClientWidth() const
452 { 452 {
453 return snapSizeToPixel(clientWidth(), location().x() + clientLeft()); 453 return snapSizeToPixel(clientWidth(), clientLeft());
eae 2016/07/13 20:18:33 The location is needed to correctly snap the clien
rhogan 2016/07/17 18:37:45 OK, so do we have to live with a scrollbar on this
454 } 454 }
455 455
456 int LayoutBox::pixelSnappedClientHeight() const 456 int LayoutBox::pixelSnappedClientHeight() const
457 { 457 {
458 return snapSizeToPixel(clientHeight(), location().y() + clientTop()); 458 return snapSizeToPixel(clientHeight(), clientTop());
459 } 459 }
460 460
461 int LayoutBox::pixelSnappedOffsetWidth(const Element*) const 461 int LayoutBox::pixelSnappedOffsetWidth(const Element*) const
462 { 462 {
463 return snapSizeToPixel(offsetWidth(), location().x() + clientLeft()); 463 return snapSizeToPixel(offsetWidth(), clientLeft());
464 } 464 }
465 465
466 int LayoutBox::pixelSnappedOffsetHeight(const Element*) const 466 int LayoutBox::pixelSnappedOffsetHeight(const Element*) const
467 { 467 {
468 return snapSizeToPixel(offsetHeight(), location().y() + clientTop()); 468 return snapSizeToPixel(offsetHeight(), clientTop());
469 } 469 }
470 470
471 LayoutUnit LayoutBox::scrollWidth() const 471 LayoutUnit LayoutBox::scrollWidth() const
472 { 472 {
473 if (hasOverflowClip()) 473 if (hasOverflowClip())
474 return getScrollableArea()->scrollWidth(); 474 return getScrollableArea()->scrollWidth();
475 // For objects with visible overflow, this matches IE. 475 // For objects with visible overflow, this matches IE.
476 // FIXME: Need to work right with writing modes. 476 // FIXME: Need to work right with writing modes.
477 if (style()->isLeftToRightDirection()) 477 if (style()->isLeftToRightDirection())
478 return std::max(clientWidth(), layoutOverflowRect().maxX() - borderLeft( )); 478 return std::max(clientWidth(), layoutOverflowRect().maxX() - borderLeft( ));
(...skipping 14 matching lines...) Expand all
493 return hasOverflowClip() ? LayoutUnit(getScrollableArea()->scrollXOffset()) : LayoutUnit(); 493 return hasOverflowClip() ? LayoutUnit(getScrollableArea()->scrollXOffset()) : LayoutUnit();
494 } 494 }
495 495
496 LayoutUnit LayoutBox::scrollTop() const 496 LayoutUnit LayoutBox::scrollTop() const
497 { 497 {
498 return hasOverflowClip() ? LayoutUnit(getScrollableArea()->scrollYOffset()) : LayoutUnit(); 498 return hasOverflowClip() ? LayoutUnit(getScrollableArea()->scrollYOffset()) : LayoutUnit();
499 } 499 }
500 500
501 int LayoutBox::pixelSnappedScrollWidth() const 501 int LayoutBox::pixelSnappedScrollWidth() const
502 { 502 {
503 return snapSizeToPixel(scrollWidth(), location().x() + clientLeft()); 503 return snapSizeToPixel(scrollWidth(), clientLeft());
504 } 504 }
505 505
506 int LayoutBox::pixelSnappedScrollHeight() const 506 int LayoutBox::pixelSnappedScrollHeight() const
507 { 507 {
508 if (hasOverflowClip()) 508 if (hasOverflowClip())
509 return snapSizeToPixel(getScrollableArea()->scrollHeight(), location().y () + clientTop()); 509 return snapSizeToPixel(getScrollableArea()->scrollHeight(), location().y () + clientTop());
510 // For objects with visible overflow, this matches IE. 510 // For objects with visible overflow, this matches IE.
511 // FIXME: Need to work right with writing modes. 511 // FIXME: Need to work right with writing modes.
512 return snapSizeToPixel(scrollHeight(), location().y() + clientTop()); 512 return snapSizeToPixel(scrollHeight(), clientTop());
513 } 513 }
514 514
515 void LayoutBox::setScrollLeft(LayoutUnit newLeft) 515 void LayoutBox::setScrollLeft(LayoutUnit newLeft)
516 { 516 {
517 // This doesn't hit in any tests, but since the equivalent code in setScroll Top 517 // This doesn't hit in any tests, but since the equivalent code in setScroll Top
518 // does, presumably this code does as well. 518 // does, presumably this code does as well.
519 DisableCompositingQueryAsserts disabler; 519 DisableCompositingQueryAsserts disabler;
520 520
521 if (hasOverflowClip()) 521 if (hasOverflowClip())
522 getScrollableArea()->scrollToXOffset(newLeft, ScrollOffsetClamped, Scrol lBehaviorAuto); 522 getScrollableArea()->scrollToXOffset(newLeft, ScrollOffsetClamped, Scrol lBehaviorAuto);
(...skipping 4412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 m_rareData->m_snapAreas->remove(&snapArea); 4935 m_rareData->m_snapAreas->remove(&snapArea);
4936 } 4936 }
4937 } 4937 }
4938 4938
4939 SnapAreaSet* LayoutBox::snapAreas() const 4939 SnapAreaSet* LayoutBox::snapAreas() const
4940 { 4940 {
4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4942 } 4942 }
4943 4943
4944 } // namespace blink 4944 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698