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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2897033002: Make room for any scrollbars in the content box and border box. (Closed)
Patch Set: Rebaseline tests that got wider/taller objects. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index a35862c461793a1fd504d8c8cc86ad5e55166bba..092d313fa65dba5601ce612c348baed1818f57ad 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -984,17 +984,6 @@ int LayoutBox::HorizontalScrollbarHeight() const {
return GetScrollableArea()->HorizontalScrollbarHeight();
}
-LayoutUnit LayoutBox::VerticalScrollbarWidthClampedToContentBox() const {
- LayoutUnit width(VerticalScrollbarWidth());
- DCHECK_GE(width, LayoutUnit());
- if (width) {
- LayoutUnit minimum_width = LogicalWidth() - BorderAndPaddingLogicalWidth();
- DCHECK_GE(minimum_width, LayoutUnit());
- width = std::min(width, minimum_width);
- }
- return width;
-}
-
ScrollResult LayoutBox::Scroll(ScrollGranularity granularity,
const FloatSize& delta) {
// Presumably the same issue as in setScrollTop. See crbug.com/343132.
@@ -1470,19 +1459,21 @@ void LayoutBox::ClearOverrideContainingBlockContentLogicalHeight() {
LayoutUnit LayoutBox::AdjustBorderBoxLogicalWidthForBoxSizing(
float width) const {
LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalWidth();
+ LayoutUnit scrollbar_size(VerticalScrollbarWidth());
LayoutUnit result(width);
if (Style()->BoxSizing() == EBoxSizing::kContentBox)
- return result + borders_plus_padding;
- return std::max(result, borders_plus_padding);
+ return std::max(result, scrollbar_size) + borders_plus_padding;
+ return std::max(result, borders_plus_padding + scrollbar_size);
}
LayoutUnit LayoutBox::AdjustBorderBoxLogicalHeightForBoxSizing(
float height) const {
LayoutUnit borders_plus_padding = CollapsedBorderAndCSSPaddingLogicalHeight();
+ LayoutUnit scrollbar_size(HorizontalScrollbarHeight());
LayoutUnit result(height);
if (Style()->BoxSizing() == EBoxSizing::kContentBox)
- return result + borders_plus_padding;
- return std::max(result, borders_plus_padding);
+ return std::max(result, scrollbar_size) + borders_plus_padding;
+ return std::max(result, borders_plus_padding + scrollbar_size);
}
LayoutUnit LayoutBox::AdjustContentBoxLogicalWidthForBoxSizing(
@@ -1490,7 +1481,7 @@ LayoutUnit LayoutBox::AdjustContentBoxLogicalWidthForBoxSizing(
LayoutUnit result(width);
if (Style()->BoxSizing() == EBoxSizing::kBorderBox)
result -= CollapsedBorderAndCSSPaddingLogicalWidth();
- return std::max(LayoutUnit(), result);
+ return std::max(LayoutUnit(VerticalScrollbarWidth()), result);
}
LayoutUnit LayoutBox::AdjustContentBoxLogicalHeightForBoxSizing(
@@ -1498,7 +1489,7 @@ LayoutUnit LayoutBox::AdjustContentBoxLogicalHeightForBoxSizing(
LayoutUnit result(height);
if (Style()->BoxSizing() == EBoxSizing::kBorderBox)
result -= CollapsedBorderAndCSSPaddingLogicalHeight();
- return std::max(LayoutUnit(), result);
+ return std::max(LayoutUnit(HorizontalScrollbarHeight()), result);
}
// Hit Testing
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698