| OLD | NEW |
| 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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 return GetScrollableArea()->VerticalScrollbarWidth(); | 977 return GetScrollableArea()->VerticalScrollbarWidth(); |
| 978 } | 978 } |
| 979 | 979 |
| 980 int LayoutBox::HorizontalScrollbarHeight() const { | 980 int LayoutBox::HorizontalScrollbarHeight() const { |
| 981 if (!HasOverflowClip() || Style()->OverflowX() == EOverflow::kOverlay) | 981 if (!HasOverflowClip() || Style()->OverflowX() == EOverflow::kOverlay) |
| 982 return 0; | 982 return 0; |
| 983 | 983 |
| 984 return GetScrollableArea()->HorizontalScrollbarHeight(); | 984 return GetScrollableArea()->HorizontalScrollbarHeight(); |
| 985 } | 985 } |
| 986 | 986 |
| 987 LayoutUnit LayoutBox::VerticalScrollbarWidthClampedToContentBox() const { | |
| 988 LayoutUnit width(VerticalScrollbarWidth()); | |
| 989 DCHECK_GE(width, LayoutUnit()); | |
| 990 if (width) { | |
| 991 LayoutUnit minimum_width = LogicalWidth() - BorderAndPaddingLogicalWidth(); | |
| 992 DCHECK_GE(minimum_width, LayoutUnit()); | |
| 993 width = std::min(width, minimum_width); | |
| 994 } | |
| 995 return width; | |
| 996 } | |
| 997 | |
| 998 ScrollResult LayoutBox::Scroll(ScrollGranularity granularity, | 987 ScrollResult LayoutBox::Scroll(ScrollGranularity granularity, |
| 999 const FloatSize& delta) { | 988 const FloatSize& delta) { |
| 1000 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 989 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
| 1001 DisableCompositingQueryAsserts disabler; | 990 DisableCompositingQueryAsserts disabler; |
| 1002 | 991 |
| 1003 if (!GetScrollableArea()) | 992 if (!GetScrollableArea()) |
| 1004 return ScrollResult(); | 993 return ScrollResult(); |
| 1005 | 994 |
| 1006 return GetScrollableArea()->UserScroll(granularity, delta); | 995 return GetScrollableArea()->UserScroll(granularity, delta); |
| 1007 } | 996 } |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 void LayoutBox::ClearOverrideContainingBlockContentLogicalHeight() { | 1452 void LayoutBox::ClearOverrideContainingBlockContentLogicalHeight() { |
| 1464 if (!rare_data_) | 1453 if (!rare_data_) |
| 1465 return; | 1454 return; |
| 1466 EnsureRareData().has_override_containing_block_content_logical_height_ = | 1455 EnsureRareData().has_override_containing_block_content_logical_height_ = |
| 1467 false; | 1456 false; |
| 1468 } | 1457 } |
| 1469 | 1458 |
| 1470 LayoutUnit LayoutBox::AdjustBorderBoxLogicalWidthForBoxSizing( | 1459 LayoutUnit LayoutBox::AdjustBorderBoxLogicalWidthForBoxSizing( |
| 1471 float width) const { | 1460 float width) const { |
| 1472 LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalWidth(); | 1461 LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalWidth(); |
| 1462 LayoutUnit scrollbar_size(VerticalScrollbarWidth()); |
| 1473 LayoutUnit result(width); | 1463 LayoutUnit result(width); |
| 1474 if (Style()->BoxSizing() == EBoxSizing::kContentBox) | 1464 if (Style()->BoxSizing() == EBoxSizing::kContentBox) |
| 1475 return result + borders_plus_padding; | 1465 return std::max(result, scrollbar_size) + borders_plus_padding; |
| 1476 return std::max(result, borders_plus_padding); | 1466 return std::max(result, borders_plus_padding + scrollbar_size); |
| 1477 } | 1467 } |
| 1478 | 1468 |
| 1479 LayoutUnit LayoutBox::AdjustBorderBoxLogicalHeightForBoxSizing( | 1469 LayoutUnit LayoutBox::AdjustBorderBoxLogicalHeightForBoxSizing( |
| 1480 float height) const { | 1470 float height) const { |
| 1481 LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalHeight(); | 1471 LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalHeight(); |
| 1472 LayoutUnit scrollbar_size(HorizontalScrollbarHeight()); |
| 1482 LayoutUnit result(height); | 1473 LayoutUnit result(height); |
| 1483 if (Style()->BoxSizing() == EBoxSizing::kContentBox) | 1474 if (Style()->BoxSizing() == EBoxSizing::kContentBox) |
| 1484 return result + borders_plus_padding; | 1475 return std::max(result, scrollbar_size) + borders_plus_padding; |
| 1485 return std::max(result, borders_plus_padding); | 1476 return std::max(result, borders_plus_padding + scrollbar_size); |
| 1486 } | 1477 } |
| 1487 | 1478 |
| 1488 LayoutUnit LayoutBox::AdjustContentBoxLogicalWidthForBoxSizing( | 1479 LayoutUnit LayoutBox::AdjustContentBoxLogicalWidthForBoxSizing( |
| 1489 float width) const { | 1480 float width) const { |
| 1490 LayoutUnit result(width); | 1481 LayoutUnit result(width); |
| 1491 if (Style()->BoxSizing() == EBoxSizing::kBorderBox) | 1482 if (Style()->BoxSizing() == EBoxSizing::kBorderBox) |
| 1492 result -= CollapsedBorderAndCSSPaddingLogicalWidth(); | 1483 result -= CollapsedBorderAndCSSPaddingLogicalWidth(); |
| 1493 return std::max(LayoutUnit(), result); | 1484 return std::max(LayoutUnit(VerticalScrollbarWidth()), result); |
| 1494 } | 1485 } |
| 1495 | 1486 |
| 1496 LayoutUnit LayoutBox::AdjustContentBoxLogicalHeightForBoxSizing( | 1487 LayoutUnit LayoutBox::AdjustContentBoxLogicalHeightForBoxSizing( |
| 1497 float height) const { | 1488 float height) const { |
| 1498 LayoutUnit result(height); | 1489 LayoutUnit result(height); |
| 1499 if (Style()->BoxSizing() == EBoxSizing::kBorderBox) | 1490 if (Style()->BoxSizing() == EBoxSizing::kBorderBox) |
| 1500 result -= CollapsedBorderAndCSSPaddingLogicalHeight(); | 1491 result -= CollapsedBorderAndCSSPaddingLogicalHeight(); |
| 1501 return std::max(LayoutUnit(), result); | 1492 return std::max(LayoutUnit(HorizontalScrollbarHeight()), result); |
| 1502 } | 1493 } |
| 1503 | 1494 |
| 1504 // Hit Testing | 1495 // Hit Testing |
| 1505 bool LayoutBox::NodeAtPoint(HitTestResult& result, | 1496 bool LayoutBox::NodeAtPoint(HitTestResult& result, |
| 1506 const HitTestLocation& location_in_container, | 1497 const HitTestLocation& location_in_container, |
| 1507 const LayoutPoint& accumulated_offset, | 1498 const LayoutPoint& accumulated_offset, |
| 1508 HitTestAction action) { | 1499 HitTestAction action) { |
| 1509 LayoutPoint adjusted_location = accumulated_offset + Location(); | 1500 LayoutPoint adjusted_location = accumulated_offset + Location(); |
| 1510 | 1501 |
| 1511 if (!RootScrollerUtil::IsEffective(*this)) { | 1502 if (!RootScrollerUtil::IsEffective(*this)) { |
| (...skipping 4386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5898 void LayoutBox::MutableForPainting:: | 5889 void LayoutBox::MutableForPainting:: |
| 5899 SavePreviousContentBoxSizeAndLayoutOverflowRect() { | 5890 SavePreviousContentBoxSizeAndLayoutOverflowRect() { |
| 5900 auto& rare_data = GetLayoutBox().EnsureRareData(); | 5891 auto& rare_data = GetLayoutBox().EnsureRareData(); |
| 5901 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; | 5892 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; |
| 5902 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); | 5893 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); |
| 5903 rare_data.previous_layout_overflow_rect_ = | 5894 rare_data.previous_layout_overflow_rect_ = |
| 5904 GetLayoutBox().LayoutOverflowRect(); | 5895 GetLayoutBox().LayoutOverflowRect(); |
| 5905 } | 5896 } |
| 5906 | 5897 |
| 5907 } // namespace blink | 5898 } // namespace blink |
| OLD | NEW |