| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
| 4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
| 5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 void LayoutTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&
layouter) | 172 void LayoutTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&
layouter) |
| 173 { | 173 { |
| 174 int oldIntrinsicPaddingBefore = intrinsicPaddingBefore(); | 174 int oldIntrinsicPaddingBefore = intrinsicPaddingBefore(); |
| 175 int oldIntrinsicPaddingAfter = intrinsicPaddingAfter(); | 175 int oldIntrinsicPaddingAfter = intrinsicPaddingAfter(); |
| 176 int logicalHeightWithoutIntrinsicPadding = pixelSnappedLogicalHeight() - old
IntrinsicPaddingBefore - oldIntrinsicPaddingAfter; | 176 int logicalHeightWithoutIntrinsicPadding = pixelSnappedLogicalHeight() - old
IntrinsicPaddingBefore - oldIntrinsicPaddingAfter; |
| 177 | 177 |
| 178 int intrinsicPaddingBefore = 0; | 178 int intrinsicPaddingBefore = 0; |
| 179 switch (style()->verticalAlign()) { | 179 switch (style()->verticalAlign()) { |
| 180 case SUB: | 180 case VerticalAlignSub: |
| 181 case SUPER: | 181 case VerticalAlignSuper: |
| 182 case TEXT_TOP: | 182 case VerticalAlignTextTop: |
| 183 case TEXT_BOTTOM: | 183 case VerticalAlignTextBottom: |
| 184 case LENGTH: | 184 case VerticalAlignLength: |
| 185 case BASELINE: { | 185 case VerticalAlignBaseline: { |
| 186 int baseline = cellBaselinePosition(); | 186 int baseline = cellBaselinePosition(); |
| 187 if (baseline > borderBefore() + paddingBefore()) | 187 if (baseline > borderBefore() + paddingBefore()) |
| 188 intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (basel
ine - oldIntrinsicPaddingBefore); | 188 intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (basel
ine - oldIntrinsicPaddingBefore); |
| 189 break; | 189 break; |
| 190 } | 190 } |
| 191 case TOP: | 191 case VerticalAlignTop: |
| 192 break; | 192 break; |
| 193 case MIDDLE: | 193 case VerticalAlignMiddle: |
| 194 intrinsicPaddingBefore = (rowHeight - logicalHeightWithoutIntrinsicPaddi
ng) / 2; | 194 intrinsicPaddingBefore = (rowHeight - logicalHeightWithoutIntrinsicPaddi
ng) / 2; |
| 195 break; | 195 break; |
| 196 case BOTTOM: | 196 case VerticalAlignBottom: |
| 197 intrinsicPaddingBefore = rowHeight - logicalHeightWithoutIntrinsicPaddin
g; | 197 intrinsicPaddingBefore = rowHeight - logicalHeightWithoutIntrinsicPaddin
g; |
| 198 break; | 198 break; |
| 199 case BASELINE_MIDDLE: | 199 case VerticalAlignBaselineMiddle: |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 | 202 |
| 203 int intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding
- intrinsicPaddingBefore; | 203 int intrinsicPaddingAfter = rowHeight - logicalHeightWithoutIntrinsicPadding
- intrinsicPaddingBefore; |
| 204 setIntrinsicPaddingBefore(intrinsicPaddingBefore); | 204 setIntrinsicPaddingBefore(intrinsicPaddingBefore); |
| 205 setIntrinsicPaddingAfter(intrinsicPaddingAfter); | 205 setIntrinsicPaddingAfter(intrinsicPaddingAfter); |
| 206 | 206 |
| 207 // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it o
nly shifts the cell inside the row but | 207 // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it o
nly shifts the cell inside the row but |
| 208 // doesn't change the logical height. | 208 // doesn't change the logical height. |
| 209 if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingA
fter != oldIntrinsicPaddingAfter) | 209 if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingA
fter != oldIntrinsicPaddingAfter) |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 int scrollbarHeight = scrollbarLogicalHeight(); | 979 int scrollbarHeight = scrollbarLogicalHeight(); |
| 980 if (!scrollbarHeight) | 980 if (!scrollbarHeight) |
| 981 return; // Not sure if we should be doing something when a scrollbar goe
s away or not. | 981 return; // Not sure if we should be doing something when a scrollbar goe
s away or not. |
| 982 | 982 |
| 983 // We only care if the scrollbar that affects our intrinsic padding has been
added. | 983 // We only care if the scrollbar that affects our intrinsic padding has been
added. |
| 984 if ((isHorizontalWritingMode() && !horizontalScrollbarChanged) | 984 if ((isHorizontalWritingMode() && !horizontalScrollbarChanged) |
| 985 || (!isHorizontalWritingMode() && !verticalScrollbarChanged)) | 985 || (!isHorizontalWritingMode() && !verticalScrollbarChanged)) |
| 986 return; | 986 return; |
| 987 | 987 |
| 988 // Shrink our intrinsic padding as much as possible to accommodate the scrol
lbar. | 988 // Shrink our intrinsic padding as much as possible to accommodate the scrol
lbar. |
| 989 if (style()->verticalAlign() == MIDDLE) { | 989 if (style()->verticalAlign() == VerticalAlignMiddle) { |
| 990 LayoutUnit totalHeight = logicalHeight(); | 990 LayoutUnit totalHeight = logicalHeight(); |
| 991 LayoutUnit heightWithoutIntrinsicPadding = totalHeight - intrinsicPaddin
gBefore() - intrinsicPaddingAfter(); | 991 LayoutUnit heightWithoutIntrinsicPadding = totalHeight - intrinsicPaddin
gBefore() - intrinsicPaddingAfter(); |
| 992 totalHeight -= scrollbarHeight; | 992 totalHeight -= scrollbarHeight; |
| 993 LayoutUnit newBeforePadding = (totalHeight - heightWithoutIntrinsicPaddi
ng) / 2; | 993 LayoutUnit newBeforePadding = (totalHeight - heightWithoutIntrinsicPaddi
ng) / 2; |
| 994 LayoutUnit newAfterPadding = totalHeight - heightWithoutIntrinsicPadding
- newBeforePadding; | 994 LayoutUnit newAfterPadding = totalHeight - heightWithoutIntrinsicPadding
- newBeforePadding; |
| 995 setIntrinsicPaddingBefore(newBeforePadding); | 995 setIntrinsicPaddingBefore(newBeforePadding); |
| 996 setIntrinsicPaddingAfter(newAfterPadding); | 996 setIntrinsicPaddingAfter(newAfterPadding); |
| 997 } else { | 997 } else { |
| 998 setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight); | 998 setIntrinsicPaddingAfter(intrinsicPaddingAfter() - scrollbarHeight); |
| 999 } | 999 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1017 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const | 1017 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR
ect) const |
| 1018 { | 1018 { |
| 1019 // If this object has layer, the area of collapsed borders should be transpa
rent | 1019 // If this object has layer, the area of collapsed borders should be transpa
rent |
| 1020 // to expose the collapsed borders painted on the underlying layer. | 1020 // to expose the collapsed borders painted on the underlying layer. |
| 1021 if (hasLayer() && table()->collapseBorders()) | 1021 if (hasLayer() && table()->collapseBorders()) |
| 1022 return false; | 1022 return false; |
| 1023 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); | 1023 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 } // namespace blink | 1026 } // namespace blink |
| OLD | NEW |