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

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

Issue 2422103003: Separate method for calculating logical height based on CSS properties. (Closed)
Patch Set: Created 4 years, 2 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/LayoutTable.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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 7e781b9589895d5fe22b902de59437fa6c56b2f3..056550b464952e3f1eeb169dd389251685fcc39d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -361,7 +361,7 @@ void LayoutTable::updateLogicalWidth() {
// length and computes its actual value.
LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(
const Length& styleLogicalWidth,
- LayoutUnit availableWidth) {
+ LayoutUnit availableWidth) const {
if (styleLogicalWidth.isIntrinsic())
return computeIntrinsicLogicalWidthUsing(
styleLogicalWidth, availableWidth,
@@ -382,7 +382,7 @@ LayoutUnit LayoutTable::convertStyleLogicalWidthToComputedWidth(
}
LayoutUnit LayoutTable::convertStyleLogicalHeightToComputedHeight(
- const Length& styleLogicalHeight) {
+ const Length& styleLogicalHeight) const {
LayoutUnit borderAndPaddingBefore =
borderBefore() + (collapseBorders() ? LayoutUnit() : paddingBefore());
LayoutUnit borderAndPaddingAfter =
@@ -455,6 +455,38 @@ void LayoutTable::layoutSection(LayoutTableSection& section,
setLogicalHeight(logicalHeight() + sectionLogicalHeight);
}
+LayoutUnit LayoutTable::logicalHeightFromStyle() const {
+ LayoutUnit computedLogicalHeight;
+ Length logicalHeightLength = style()->logicalHeight();
+ if (logicalHeightLength.isIntrinsic() ||
+ (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) {
+ computedLogicalHeight =
+ convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
+ }
+
+ Length logicalMaxHeightLength = style()->logicalMaxHeight();
+ if (logicalMaxHeightLength.isIntrinsic() ||
+ (logicalMaxHeightLength.isSpecified() &&
+ !logicalMaxHeightLength.isNegative())) {
+ LayoutUnit computedMaxLogicalHeight =
+ convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
+ computedLogicalHeight =
+ std::min(computedLogicalHeight, computedMaxLogicalHeight);
+ }
+
+ Length logicalMinHeightLength = style()->logicalMinHeight();
+ if (logicalMinHeightLength.isIntrinsic() ||
+ (logicalMinHeightLength.isSpecified() &&
+ !logicalMinHeightLength.isNegative())) {
+ LayoutUnit computedMinLogicalHeight =
+ convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength);
+ computedLogicalHeight =
+ std::max(computedLogicalHeight, computedMinLogicalHeight);
+ }
+
+ return computedLogicalHeight;
+}
+
void LayoutTable::distributeExtraLogicalHeight(int extraLogicalHeight) {
if (extraLogicalHeight <= 0)
return;
@@ -613,34 +645,7 @@ void LayoutTable::layout() {
setLogicalHeight(tableBoxLogicalTop + borderAndPaddingBefore);
- LayoutUnit computedLogicalHeight;
-
- Length logicalHeightLength = style()->logicalHeight();
- if (logicalHeightLength.isIntrinsic() ||
- (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive()))
- computedLogicalHeight =
- convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
-
- Length logicalMaxHeightLength = style()->logicalMaxHeight();
- if (logicalMaxHeightLength.isIntrinsic() ||
- (logicalMaxHeightLength.isSpecified() &&
- !logicalMaxHeightLength.isNegative())) {
- LayoutUnit computedMaxLogicalHeight =
- convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
- computedLogicalHeight =
- std::min(computedLogicalHeight, computedMaxLogicalHeight);
- }
-
- Length logicalMinHeightLength = style()->logicalMinHeight();
- if (logicalMinHeightLength.isIntrinsic() ||
- (logicalMinHeightLength.isSpecified() &&
- !logicalMinHeightLength.isNegative())) {
- LayoutUnit computedMinLogicalHeight =
- convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength);
- computedLogicalHeight =
- std::max(computedLogicalHeight, computedMinLogicalHeight);
- }
-
+ LayoutUnit computedLogicalHeight = logicalHeightFromStyle();
LayoutUnit totalSectionLogicalHeight;
if (topSection) {
totalSectionLogicalHeight =
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698