|
Lines 2135-2151
void RenderBox::computePositionedLogical
Source/WebCore/rendering/RenderBox.cpp_sec1
|
| 2135 |
// relative positioned inline. |
2135 |
// relative positioned inline. |
| 2136 |
const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container()); |
2136 |
const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container()); |
| 2137 |
|
2137 |
|
| 2138 |
const int containerWidth = containingBlockLogicalWidthForPositioned(containerBlock); |
2138 |
const int containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock); |
| 2139 |
|
2139 |
|
| 2140 |
// To match WinIE, in quirks mode use the parent's 'direction' property |
2140 |
// To match WinIE, in quirks mode use the parent's 'direction' property |
| 2141 |
// instead of the the container block's. |
2141 |
// instead of the the container block's. |
| 2142 |
TextDirection containerDirection = (document()->inQuirksMode()) ? parent()->style()->direction() : containerBlock->style()->direction(); |
2142 |
TextDirection containerDirection = (document()->inQuirksMode()) ? parent()->style()->direction() : containerBlock->style()->direction(); |
| 2143 |
|
2143 |
|
| 2144 |
const int bordersPlusPadding = borderAndPaddingWidth(); |
2144 |
const int bordersPlusPadding = borderAndPaddingLogicalWidth(); |
| 2145 |
const Length marginLeft = style()->marginLeft(); |
2145 |
const Length marginLogicalLeft = style()->isHorizontalWritingMode() ? style()->marginLeft() : style()->marginTop(); |
| 2146 |
const Length marginRight = style()->marginRight(); |
2146 |
const Length marginLogicalRight = style()->isHorizontalWritingMode() ? style()->marginRight() : style()->marginBottom(); |
| 2147 |
Length left = style()->left(); |
2147 |
int& marginLogicalLeftAlias = style()->isHorizontalWritingMode() ? m_marginLeft : m_marginTop; |
| 2148 |
Length right = style()->right(); |
2148 |
int& marginLogicalRightAlias = style()->isHorizontalWritingMode() ? m_marginRight : m_marginBottom; |
|
|
2149 |
|
| 2150 |
Length logicalLeft = style()->logicalLeft(); |
| 2151 |
Length logicalRight = style()->logicalRight(); |
| 2149 |
|
2152 |
|
| 2150 |
/*---------------------------------------------------------------------------*\ |
2153 |
/*---------------------------------------------------------------------------*\ |
| 2151 |
* For the purposes of this section and the next, the term "static position" |
2154 |
* For the purposes of this section and the next, the term "static position" |
|
Lines 2173-2179
void RenderBox::computePositionedLogical
Source/WebCore/rendering/RenderBox.cpp_sec2
|
| 2173 |
|
2176 |
|
| 2174 |
// see FIXME 2 |
2177 |
// see FIXME 2 |
| 2175 |
// Calculate the static distance if needed. |
2178 |
// Calculate the static distance if needed. |
| 2176 |
if (left.isAuto() && right.isAuto()) { |
2179 |
// FIXME: The static distance computation has not been patched for writing modes yet. |
|
|
2180 |
if (logicalLeft.isAuto() && logicalRight.isAuto()) { |
| 2177 |
if (containerDirection == LTR) { |
2181 |
if (containerDirection == LTR) { |
| 2178 |
// 'staticX' should already have been set through layout of the parent. |
2182 |
// 'staticX' should already have been set through layout of the parent. |
| 2179 |
int staticPosition = layer()->staticX() - containerBlock->borderLeft(); |
2183 |
int staticPosition = layer()->staticX() - containerBlock->borderLeft(); |
|
Lines 2181-2261
void RenderBox::computePositionedLogical
Source/WebCore/rendering/RenderBox.cpp_sec3
|
| 2181 |
if (curr->isBox()) |
2185 |
if (curr->isBox()) |
| 2182 |
staticPosition += toRenderBox(curr)->x(); |
2186 |
staticPosition += toRenderBox(curr)->x(); |
| 2183 |
} |
2187 |
} |
| 2184 |
left.setValue(Fixed, staticPosition); |
2188 |
logicalLeft.setValue(Fixed, staticPosition); |
| 2185 |
} else { |
2189 |
} else { |
| 2186 |
RenderBox* enclosingBox = parent()->enclosingBox(); |
2190 |
RenderBox* enclosingBox = parent()->enclosingBox(); |
| 2187 |
// 'staticX' should already have been set through layout of the parent. |
2191 |
// 'staticX' should already have been set through layout of the parent. |
| 2188 |
int staticPosition = layer()->staticX() + containerWidth + containerBlock->borderRight(); |
2192 |
int staticPosition = layer()->staticX() + containerLogicalWidth + containerBlock->borderRight(); |
| 2189 |
staticPosition -= enclosingBox->width(); |
2193 |
staticPosition -= enclosingBox->width(); |
| 2190 |
for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->parent()) { |
2194 |
for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->parent()) { |
| 2191 |
if (curr->isBox()) |
2195 |
if (curr->isBox()) |
| 2192 |
staticPosition -= toRenderBox(curr)->x(); |
2196 |
staticPosition -= toRenderBox(curr)->x(); |
| 2193 |
} |
2197 |
} |
| 2194 |
right.setValue(Fixed, staticPosition); |
2198 |
logicalRight.setValue(Fixed, staticPosition); |
| 2195 |
} |
2199 |
} |
| 2196 |
} |
2200 |
} |
| 2197 |
|
2201 |
|
| 2198 |
// Calculate constraint equation values for 'width' case. |
2202 |
// Calculate constraint equation values for 'width' case. |
| 2199 |
int widthResult; |
2203 |
int logicalWidthResult; |
| 2200 |
int xResult; |
2204 |
int logicalLeftResult; |
| 2201 |
computePositionedLogicalWidthUsing(style()->width(), containerBlock, containerDirection, |
2205 |
computePositionedLogicalWidthUsing(style()->logicalWidth(), containerBlock, containerDirection, |
| 2202 |
containerWidth, bordersPlusPadding, |
2206 |
containerLogicalWidth, bordersPlusPadding, |
| 2203 |
left, right, marginLeft, marginRight, |
2207 |
logicalLeft, logicalRight, marginLogicalLeft, marginLogicalRight, |
| 2204 |
widthResult, m_marginLeft, m_marginRight, xResult); |
2208 |
logicalWidthResult, marginLogicalLeftAlias, marginLogicalRightAlias, logicalLeftResult); |
| 2205 |
setWidth(widthResult); |
2209 |
setLogicalWidth(logicalWidthResult); |
| 2206 |
setX(xResult); |
2210 |
setLogicalLeft(logicalLeftResult); |
| 2207 |
|
2211 |
|
| 2208 |
// Calculate constraint equation values for 'max-width' case. |
2212 |
// Calculate constraint equation values for 'max-width' case. |
| 2209 |
if (!style()->maxWidth().isUndefined()) { |
2213 |
if (!style()->logicalMaxWidth().isUndefined()) { |
| 2210 |
int maxWidth; |
2214 |
int maxLogicalWidth; |
| 2211 |
int maxMarginLeft; |
2215 |
int maxMarginLogicalLeft; |
| 2212 |
int maxMarginRight; |
2216 |
int maxMarginLogicalRight; |
| 2213 |
int maxXPos; |
2217 |
int maxLogicalLeftPos; |
| 2214 |
|
2218 |
|
| 2215 |
computePositionedLogicalWidthUsing(style()->maxWidth(), containerBlock, containerDirection, |
2219 |
computePositionedLogicalWidthUsing(style()->logicalMaxWidth(), containerBlock, containerDirection, |
| 2216 |
containerWidth, bordersPlusPadding, |
2220 |
containerLogicalWidth, bordersPlusPadding, |
| 2217 |
left, right, marginLeft, marginRight, |
2221 |
logicalLeft, logicalRight, marginLogicalLeft, marginLogicalRight, |
| 2218 |
maxWidth, maxMarginLeft, maxMarginRight, maxXPos); |
2222 |
maxLogicalWidth, maxMarginLogicalLeft, maxMarginLogicalRight, maxLogicalLeftPos); |
| 2219 |
|
2223 |
|
| 2220 |
if (width() > maxWidth) { |
2224 |
if (logicalWidth() > maxLogicalWidth) { |
| 2221 |
setWidth(maxWidth); |
2225 |
setLogicalWidth(maxLogicalWidth); |
| 2222 |
m_marginLeft = maxMarginLeft; |
2226 |
marginLogicalLeftAlias = maxMarginLogicalLeft; |
| 2223 |
m_marginRight = maxMarginRight; |
2227 |
marginLogicalRightAlias = maxMarginLogicalRight; |
| 2224 |
m_frameRect.setX(maxXPos); |
2228 |
setLogicalLeft(maxLogicalLeftPos); |
| 2225 |
} |
2229 |
} |
| 2226 |
} |
2230 |
} |
| 2227 |
|
2231 |
|
| 2228 |
// Calculate constraint equation values for 'min-width' case. |
2232 |
// Calculate constraint equation values for 'min-width' case. |
| 2229 |
if (!style()->minWidth().isZero()) { |
2233 |
if (!style()->logicalMinWidth().isZero()) { |
| 2230 |
int minWidth; |
2234 |
int minLogicalWidth; |
| 2231 |
int minMarginLeft; |
2235 |
int minMarginLogicalLeft; |
| 2232 |
int minMarginRight; |
2236 |
int minMarginLogicalRight; |
| 2233 |
int minXPos; |
2237 |
int minLogicalLeftPos; |
| 2234 |
|
2238 |
|
| 2235 |
computePositionedLogicalWidthUsing(style()->minWidth(), containerBlock, containerDirection, |
2239 |
computePositionedLogicalWidthUsing(style()->logicalMinWidth(), containerBlock, containerDirection, |
| 2236 |
containerWidth, bordersPlusPadding, |
2240 |
containerLogicalWidth, bordersPlusPadding, |
| 2237 |
left, right, marginLeft, marginRight, |
2241 |
logicalLeft, logicalRight, marginLogicalLeft, marginLogicalRight, |
| 2238 |
minWidth, minMarginLeft, minMarginRight, minXPos); |
2242 |
minLogicalWidth, minMarginLogicalLeft, minMarginLogicalRight, minLogicalLeftPos); |
| 2239 |
|
2243 |
|
| 2240 |
if (width() < minWidth) { |
2244 |
if (logicalWidth() < minLogicalWidth) { |
| 2241 |
setWidth(minWidth); |
2245 |
setLogicalWidth(minLogicalWidth); |
| 2242 |
m_marginLeft = minMarginLeft; |
2246 |
marginLogicalLeftAlias = minMarginLogicalLeft; |
| 2243 |
m_marginRight = minMarginRight; |
2247 |
marginLogicalRightAlias = minMarginLogicalRight; |
| 2244 |
m_frameRect.setX(minXPos); |
2248 |
setLogicalLeft(minLogicalLeftPos); |
| 2245 |
} |
2249 |
} |
| 2246 |
} |
2250 |
} |
| 2247 |
|
2251 |
|
| 2248 |
if (stretchesToMinIntrinsicLogicalWidth() && width() < minPreferredLogicalWidth() - bordersPlusPadding) { |
2252 |
if (stretchesToMinIntrinsicLogicalWidth() && logicalWidth() < minPreferredLogicalWidth() - bordersPlusPadding) { |
| 2249 |
computePositionedLogicalWidthUsing(Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection, |
2253 |
computePositionedLogicalWidthUsing(Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection, |
| 2250 |
containerWidth, bordersPlusPadding, |
2254 |
containerLogicalWidth, bordersPlusPadding, |
| 2251 |
left, right, marginLeft, marginRight, |
2255 |
logicalLeft, logicalRight, marginLogicalLeft, marginLogicalRight, |
| 2252 |
widthResult, m_marginLeft, m_marginRight, xResult); |
2256 |
logicalWidthResult, marginLogicalLeftAlias, marginLogicalRightAlias, logicalLeftResult); |
| 2253 |
setWidth(widthResult); |
2257 |
setLogicalWidth(logicalWidthResult); |
| 2254 |
setX(xResult); |
2258 |
setLogicalLeft(logicalLeftResult); |
| 2255 |
} |
2259 |
} |
| 2256 |
|
2260 |
|
| 2257 |
// Put width() into correct form. |
2261 |
// Put logicalWidth() into correct form. |
| 2258 |
setWidth(width() + bordersPlusPadding); |
2262 |
setLogicalWidth(logicalWidth() + bordersPlusPadding); |
| 2259 |
} |
2263 |
} |
| 2260 |
|
2264 |
|
| 2261 |
void RenderBox::computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, |
2265 |
void RenderBox::computePositionedLogicalWidthUsing(Length width, const RenderBoxModelObject* containerBlock, TextDirection containerDirection, |