Changeset 79930 in webkit
- Timestamp:
- Feb 28, 2011, 3:21:36 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 60 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r79921 r79930 1 2011-02-28 David Hyatt <[email protected]> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=46500, make positioned elements work with vertical text. Change staticX and staticY 6 to be staticInlinePosition and staticBlockPosition. Patch all of the computations involving these variables to be writing 7 mode aware. Mixed writing modes are not yet supported. 8 9 Added new tests in fast/block/positioning/auto. 10 11 * fast/block/positioning/auto/vertical-lr: Added. 12 * fast/block/positioning/auto/vertical-lr/001.html: Added. 13 * fast/block/positioning/auto/vertical-lr/002.html: Added. 14 * fast/block/positioning/auto/vertical-lr/003.html: Added. 15 * fast/block/positioning/auto/vertical-lr/004.html: Added. 16 * fast/block/positioning/auto/vertical-lr/005.html: Added. 17 * fast/block/positioning/auto/vertical-lr/006.html: Added. 18 * fast/block/positioning/auto/vertical-lr/007.html: Added. 19 * fast/block/positioning/auto/vertical-rl: Added. 20 * fast/block/positioning/auto/vertical-rl/001.html: Added. 21 * fast/block/positioning/auto/vertical-rl/002.html: Added. 22 * fast/block/positioning/auto/vertical-rl/003.html: Added. 23 * fast/block/positioning/auto/vertical-rl/004.html: Added. 24 * fast/block/positioning/auto/vertical-rl/005.html: Added. 25 * fast/block/positioning/auto/vertical-rl/006.html: Added. 26 * fast/block/positioning/auto/vertical-rl/007.html: Added. 27 * platform/mac/fast/block/positioning/auto/vertical-lr: Added. 28 * platform/mac/fast/block/positioning/auto/vertical-lr/001-expected.checksum: Added. 29 * platform/mac/fast/block/positioning/auto/vertical-lr/001-expected.png: Added. 30 * platform/mac/fast/block/positioning/auto/vertical-lr/001-expected.txt: Added. 31 * platform/mac/fast/block/positioning/auto/vertical-lr/002-expected.checksum: Added. 32 * platform/mac/fast/block/positioning/auto/vertical-lr/002-expected.png: Added. 33 * platform/mac/fast/block/positioning/auto/vertical-lr/002-expected.txt: Added. 34 * platform/mac/fast/block/positioning/auto/vertical-lr/003-expected.checksum: Added. 35 * platform/mac/fast/block/positioning/auto/vertical-lr/003-expected.png: Added. 36 * platform/mac/fast/block/positioning/auto/vertical-lr/003-expected.txt: Added. 37 * platform/mac/fast/block/positioning/auto/vertical-lr/004-expected.checksum: Added. 38 * platform/mac/fast/block/positioning/auto/vertical-lr/004-expected.png: Added. 39 * platform/mac/fast/block/positioning/auto/vertical-lr/004-expected.txt: Added. 40 * platform/mac/fast/block/positioning/auto/vertical-lr/005-expected.checksum: Added. 41 * platform/mac/fast/block/positioning/auto/vertical-lr/005-expected.png: Added. 42 * platform/mac/fast/block/positioning/auto/vertical-lr/005-expected.txt: Added. 43 * platform/mac/fast/block/positioning/auto/vertical-lr/006-expected.checksum: Added. 44 * platform/mac/fast/block/positioning/auto/vertical-lr/006-expected.png: Added. 45 * platform/mac/fast/block/positioning/auto/vertical-lr/006-expected.txt: Added. 46 * platform/mac/fast/block/positioning/auto/vertical-lr/007-expected.checksum: Added. 47 * platform/mac/fast/block/positioning/auto/vertical-lr/007-expected.png: Added. 48 * platform/mac/fast/block/positioning/auto/vertical-lr/007-expected.txt: Added. 49 * platform/mac/fast/block/positioning/auto/vertical-rl: Added. 50 * platform/mac/fast/block/positioning/auto/vertical-rl/001-expected.checksum: Added. 51 * platform/mac/fast/block/positioning/auto/vertical-rl/001-expected.png: Added. 52 * platform/mac/fast/block/positioning/auto/vertical-rl/001-expected.txt: Added. 53 * platform/mac/fast/block/positioning/auto/vertical-rl/002-expected.checksum: Added. 54 * platform/mac/fast/block/positioning/auto/vertical-rl/002-expected.png: Added. 55 * platform/mac/fast/block/positioning/auto/vertical-rl/002-expected.txt: Added. 56 * platform/mac/fast/block/positioning/auto/vertical-rl/003-expected.checksum: Added. 57 * platform/mac/fast/block/positioning/auto/vertical-rl/003-expected.png: Added. 58 * platform/mac/fast/block/positioning/auto/vertical-rl/003-expected.txt: Added. 59 * platform/mac/fast/block/positioning/auto/vertical-rl/004-expected.checksum: Added. 60 * platform/mac/fast/block/positioning/auto/vertical-rl/004-expected.png: Added. 61 * platform/mac/fast/block/positioning/auto/vertical-rl/004-expected.txt: Added. 62 * platform/mac/fast/block/positioning/auto/vertical-rl/005-expected.checksum: Added. 63 * platform/mac/fast/block/positioning/auto/vertical-rl/005-expected.png: Added. 64 * platform/mac/fast/block/positioning/auto/vertical-rl/005-expected.txt: Added. 65 * platform/mac/fast/block/positioning/auto/vertical-rl/006-expected.checksum: Added. 66 * platform/mac/fast/block/positioning/auto/vertical-rl/006-expected.png: Added. 67 * platform/mac/fast/block/positioning/auto/vertical-rl/006-expected.txt: Added. 68 * platform/mac/fast/block/positioning/auto/vertical-rl/007-expected.checksum: Added. 69 * platform/mac/fast/block/positioning/auto/vertical-rl/007-expected.png: Added. 70 * platform/mac/fast/block/positioning/auto/vertical-rl/007-expected.txt: Added. 71 1 72 2011-02-28 Jungshik Shin <[email protected]> 2 73 -
trunk/Source/WebCore/ChangeLog
r79925 r79930 1 2011-02-28 David Hyatt <[email protected]> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=46500, make positioned elements work with vertical text. Change staticX and staticY 6 to be staticInlinePosition and staticBlockPosition. Patch all of the computations involving these variables to be writing 7 mode aware. Mixed writing modes are not yet supported. 8 9 Added new tests in fast/block/positioning/auto. 10 11 * rendering/RenderBlock.cpp: 12 (WebCore::RenderBlock::adjustPositionedBlock): 13 (WebCore::RenderBlock::layoutPositionedObjects): 14 * rendering/RenderBlock.h: 15 (WebCore::RenderBlock::startOffsetForLine): 16 * rendering/RenderBlockLineLayout.cpp: 17 (WebCore::RenderBlock::appendRunsForObject): 18 (WebCore::setStaticPositions): 19 (WebCore::RenderBlock::skipTrailingWhitespace): 20 (WebCore::RenderBlock::skipLeadingWhitespace): 21 (WebCore::RenderBlock::findNextLineBreak): 22 * rendering/RenderBox.cpp: 23 (WebCore::RenderBox::positionLineBox): 24 (WebCore::computeInlineStaticDistance): 25 (WebCore::RenderBox::computePositionedLogicalWidth): 26 (WebCore::computeBlockStaticDistance): 27 (WebCore::RenderBox::computePositionedLogicalHeight): 28 (WebCore::RenderBox::computePositionedLogicalWidthReplaced): 29 (WebCore::RenderBox::computePositionedLogicalHeightReplaced): 30 * rendering/RenderBoxModelObject.h: 31 (WebCore::RenderBoxModelObject::borderAndPaddingLogicalLeft): 32 (WebCore::RenderBoxModelObject::borderAndPaddingStart): 33 (WebCore::RenderBoxModelObject::borderLogicalLeft): 34 (WebCore::RenderBoxModelObject::borderLogicalRight): 35 * rendering/RenderFlexibleBox.cpp: 36 (WebCore::RenderFlexibleBox::layoutHorizontalBox): 37 (WebCore::RenderFlexibleBox::layoutVerticalBox): 38 * rendering/RenderInline.cpp: 39 (WebCore::RenderInline::relativePositionedInlineOffset): 40 * rendering/RenderLayer.cpp: 41 (WebCore::RenderLayer::RenderLayer): 42 * rendering/RenderLayer.h: 43 (WebCore::RenderLayer::staticInlinePosition): 44 (WebCore::RenderLayer::staticBlockPosition): 45 (WebCore::RenderLayer::setStaticInlinePosition): 46 (WebCore::RenderLayer::setStaticBlockPosition): 47 * rendering/style/RenderStyle.h: 48 (WebCore::InheritedFlags::hasAutoLeftAndRight): 49 (WebCore::InheritedFlags::hasAutoTopAndBottom): 50 (WebCore::InheritedFlags::hasStaticInlinePosition): 51 (WebCore::InheritedFlags::hasStaticBlockPosition): 52 1 53 2011-02-28 Balazs Kelemen <[email protected]> 2 54 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r79834 r79930 1414 1414 void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) 1415 1415 { 1416 if (child->style()->hasStaticX()) { 1417 if (style()->isLeftToRightDirection()) 1418 child->layer()->setStaticX(borderLeft() + paddingLeft()); 1419 else 1420 child->layer()->setStaticX(borderRight() + paddingRight()); 1421 } 1422 1423 if (child->style()->hasStaticY()) { 1424 int y = height(); 1416 bool isHorizontal = style()->isHorizontalWritingMode(); 1417 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHorizontal); 1418 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHorizontal); 1419 RenderLayer* childLayer = child->layer(); 1420 1421 if (hasStaticInlinePosition) 1422 childLayer->setStaticInlinePosition(borderAndPaddingStart()); 1423 1424 if (hasStaticBlockPosition) { 1425 int logicalTop = logicalHeight(); 1425 1426 if (!marginInfo.canCollapseWithMarginBefore()) { 1426 1427 child->computeBlockDirectionMargins(this); 1427 int margin Top = child->marginTop();1428 int collapsed TopPos = marginInfo.positiveMargin();1429 int collapsed TopNeg = marginInfo.negativeMargin();1430 if (margin Top> 0) {1431 if (margin Top > collapsedTopPos)1432 collapsed TopPos = marginTop;1428 int marginBefore = marginBeforeForChild(child); 1429 int collapsedBeforePos = marginInfo.positiveMargin(); 1430 int collapsedBeforeNeg = marginInfo.negativeMargin(); 1431 if (marginBefore > 0) { 1432 if (marginBefore > collapsedBeforePos) 1433 collapsedBeforePos = marginBefore; 1433 1434 } else { 1434 if (-margin Top > collapsedTopNeg)1435 collapsed TopNeg = -marginTop;1435 if (-marginBefore > collapsedBeforeNeg) 1436 collapsedBeforeNeg = -marginBefore; 1436 1437 } 1437 y += (collapsedTopPos - collapsedTopNeg) - marginTop; 1438 } 1439 RenderLayer* childLayer = child->layer(); 1440 if (childLayer->staticY() != y) { 1441 child->layer()->setStaticY(y); 1438 logicalTop += (collapsedBeforePos - collapsedBeforeNeg) - marginBefore; 1439 } 1440 if (childLayer->staticBlockPosition() != logicalTop) { 1441 childLayer->setStaticBlockPosition(logicalTop); 1442 1442 child->setChildNeedsLayout(true, false); 1443 1443 } … … 2122 2122 // objects that are positioned implicitly like this. Such objects are rare, and so in typical DHTML menu usage (where everything is 2123 2123 // positioned explicitly) this should not incur a performance penalty. 2124 if (relayoutChildren || (r->style()->hasStatic Y() && r->parent() != this && r->parent()->isBlockFlow()))2124 if (relayoutChildren || (r->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode()) && r->parent() != this && r->parent()->isBlockFlow())) 2125 2125 r->setChildNeedsLayout(true, false); 2126 2126 -
trunk/Source/WebCore/rendering/RenderBlock.h
r79900 r79930 102 102 int logicalRightOffsetForLine(int position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent(), firstLine); } 103 103 int logicalLeftOffsetForLine(int position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(), firstLine); } 104 104 int startOffsetForLine(int position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalRightOffsetForLine(position, firstLine); } 105 105 106 virtual VisiblePosition positionForPoint(const IntPoint&); 106 107 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r79817 r79930 116 116 { 117 117 if (start > end || obj->isFloating() || 118 (obj->isPositioned() && !obj->style()->has StaticX() && !obj->style()->hasStaticY() && !obj->container()->isRenderInline()))118 (obj->isPositioned() && !obj->style()->hasAutoLeftAndRight() && !obj->style()->hasAutoTopAndBottom() && !obj->container()->isRenderInline())) 119 119 return; 120 120 … … 1297 1297 } 1298 1298 1299 static void setStaticPositions(RenderBlock* block, RenderBox* child) 1300 { 1301 // FIXME: The math here is actually not really right. It's a best-guess approximation that 1302 // will work for the common cases 1303 RenderObject* containerBlock = child->container(); 1304 if (containerBlock->isRenderInline()) { 1305 // A relative positioned inline encloses us. In this case, we also have to determine our 1306 // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned 1307 // inline so that we can obtain the value later. 1308 toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startOffsetForLine(block->logicalHeight(), false)); 1309 toRenderInline(containerBlock)->layer()->setStaticBlockPosition(block->logicalHeight()); 1310 } 1311 1312 bool isHorizontal = block->style()->isHorizontalWritingMode(); 1313 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHorizontal); 1314 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHorizontal); 1315 1316 if (hasStaticInlinePosition) { 1317 if (child->style()->isOriginalDisplayInlineType()) 1318 child->layer()->setStaticInlinePosition(block->startOffsetForLine(block->logicalHeight(), false)); 1319 else 1320 child->layer()->setStaticInlinePosition(block->borderAndPaddingStart()); 1321 } 1322 1323 if (hasStaticBlockPosition) 1324 child->layer()->setStaticBlockPosition(block->logicalHeight()); 1325 } 1326 1299 1327 // FIXME: The entire concept of the skipTrailingWhitespace function is flawed, since we really need to be building 1300 1328 // line boxes even for containers that may ultimately collapse away. Otherwise we'll never get positioned … … 1309 1337 if (object->isFloating()) { 1310 1338 insertFloatingObject(toRenderBox(object)); 1311 } else if (object->isPositioned()) { 1312 // FIXME: The math here is actually not really right. It's a best-guess approximation that 1313 // will work for the common cases 1314 RenderObject* c = object->container(); 1315 if (c->isRenderInline()) { 1316 // A relative positioned inline encloses us. In this case, we also have to determine our 1317 // position as though we were an inline. Set |staticX| and |staticY| on the relative positioned 1318 // inline so that we can obtain the value later. 1319 toRenderInline(c)->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), false) : logicalRightOffsetForLine(height(), false)); 1320 toRenderInline(c)->layer()->setStaticY(height()); 1321 } 1322 1323 RenderBox* box = toRenderBox(object); 1324 if (box->style()->hasStaticX()) { 1325 if (box->style()->isOriginalDisplayInlineType()) 1326 box->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), false) : width() - logicalRightOffsetForLine(height(), false)); 1327 else 1328 box->layer()->setStaticX(style()->isLeftToRightDirection() ? borderLeft() + paddingLeft() : borderRight() + paddingRight()); 1329 } 1330 1331 if (box->style()->hasStaticY()) 1332 box->layer()->setStaticY(height()); 1333 } 1339 } else if (object->isPositioned()) 1340 setStaticPositions(this, toRenderBox(object)); 1334 1341 iterator.increment(); 1335 1342 } … … 1345 1352 positionNewFloatOnLine(insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine); 1346 1353 availableWidth = availableLogicalWidthForLine(logicalHeight(), firstLine); 1347 } else if (object->isPositioned()) { 1348 // FIXME: The math here is actually not really right. It's a best-guess approximation that 1349 // will work for the common cases 1350 RenderObject* c = object->container(); 1351 if (c->isRenderInline()) { 1352 // A relative positioned inline encloses us. In this case, we also have to determine our 1353 // position as though we were an inline. Set |staticX| and |staticY| on the relative positioned 1354 // inline so that we can obtain the value later. 1355 toRenderInline(c)->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), firstLine) : logicalRightOffsetForLine(height(), firstLine)); 1356 toRenderInline(c)->layer()->setStaticY(height()); 1357 } 1358 1359 RenderBox* box = toRenderBox(object); 1360 if (box->style()->hasStaticX()) { 1361 if (box->style()->isOriginalDisplayInlineType()) 1362 box->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), firstLine) : width() - logicalRightOffsetForLine(height(), firstLine)); 1363 else 1364 box->layer()->setStaticX(style()->isLeftToRightDirection() ? borderLeft() + paddingLeft() : borderRight() + paddingRight()); 1365 } 1366 1367 if (box->style()->hasStaticY()) 1368 box->layer()->setStaticY(height()); 1369 } 1354 } else if (object->isPositioned()) 1355 setStaticPositions(this, toRenderBox(object)); 1370 1356 resolver.increment(); 1371 1357 } … … 1558 1544 } else if (o->isPositioned()) { 1559 1545 // If our original display wasn't an inline type, then we can 1560 // go ahead and determine our static xposition now.1546 // go ahead and determine our static inline position now. 1561 1547 RenderBox* box = toRenderBox(o); 1562 1548 bool isInlineType = box->style()->isOriginalDisplayInlineType(); 1563 bool needToSetStaticX = box->style()->hasStaticX(); 1564 if (box->style()->hasStaticX() && !isInlineType) { 1565 box->layer()->setStaticX(o->parent()->style()->isLeftToRightDirection() ? 1566 borderLeft() + paddingLeft() : 1567 borderRight() + paddingRight()); 1568 needToSetStaticX = false; 1549 bool needToSetStaticInlinePosition = box->style()->hasStaticInlinePosition(style()->isHorizontalWritingMode()); 1550 if (needToSetStaticInlinePosition && !isInlineType) { 1551 box->layer()->setStaticInlinePosition(borderAndPaddingStart()); 1552 needToSetStaticInlinePosition = false; 1569 1553 } 1570 1554 1571 1555 // If our original display was an INLINE type, then we can go ahead 1572 1556 // and determine our static y position now. 1573 bool needToSetStatic Y = box->style()->hasStaticY();1574 if ( box->style()->hasStaticY()&& isInlineType) {1575 box->layer()->setStatic Y(height());1576 needToSetStatic Y= false;1557 bool needToSetStaticBlockPosition = box->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode()); 1558 if (needToSetStaticBlockPosition && isInlineType) { 1559 box->layer()->setStaticBlockPosition(logicalHeight()); 1560 needToSetStaticBlockPosition = false; 1577 1561 } 1578 1562 1579 bool needToCreateLineBox = needToSetStatic X || needToSetStaticY;1563 bool needToCreateLineBox = needToSetStaticInlinePosition || needToSetStaticBlockPosition; 1580 1564 RenderObject* c = o->container(); 1581 if (c->isRenderInline() && (!needToSetStatic X || !needToSetStaticY))1565 if (c->isRenderInline() && (!needToSetStaticInlinePosition || !needToSetStaticBlockPosition)) 1582 1566 needToCreateLineBox = true; 1583 1567 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r79725 r79930 1309 1309 // Cache the x position only if we were an INLINE type originally. 1310 1310 bool wasInline = style()->isOriginalDisplayInlineType(); 1311 if (wasInline && style()->hasStatic X()) {1311 if (wasInline && style()->hasStaticInlinePosition(box->isHorizontal())) { 1312 1312 // The value is cached in the xPos of the box. We only need this value if 1313 1313 // our object was inline originally, since otherwise it would have ended up underneath 1314 1314 // the inlines. 1315 layer()->setStatic X(box->x());1315 layer()->setStaticInlinePosition(lroundf(box->logicalLeft())); 1316 1316 setChildNeedsLayout(true, false); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1317 } else if (!wasInline && style()->hasStatic Y()) {1317 } else if (!wasInline && style()->hasStaticBlockPosition(box->isHorizontal())) { 1318 1318 // Our object was a block originally, so we make our normal flow position be 1319 1319 // just below the line box (as though all the inlines that came before us got 1320 1320 // wrapped in an anonymous block, which is what would have happened had we been 1321 1321 // in flow). This value was cached in the y() of the box. 1322 layer()->setStatic Y(box->y());1322 layer()->setStaticBlockPosition(box->logicalTop()); 1323 1323 setChildNeedsLayout(true, false); // Just go ahead and mark the positioned object as needing layout, so it will update its position properly. 1324 1324 } … … 2098 2098 heightResult -= (containingBlock->borderBefore() + containingBlock->borderAfter()); 2099 2099 return heightResult; 2100 } 2101 2102 static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRight, const RenderBox* child, const RenderBoxModelObject* containerBlock, int containerLogicalWidth, 2103 TextDirection containerDirection) 2104 { 2105 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) 2106 return; 2107 2108 // FIXME: The static distance computation has not been patched for mixed writing modes yet. 2109 if (containerDirection == LTR) { 2110 int staticPosition = child->layer()->staticInlinePosition() - containerBlock->borderLogicalLeft(); 2111 for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->parent()) { 2112 if (curr->isBox()) 2113 staticPosition += toRenderBox(curr)->logicalLeft(); 2114 } 2115 logicalLeft.setValue(Fixed, staticPosition); 2116 } else { 2117 RenderBox* enclosingBox = child->parent()->enclosingBox(); 2118 int staticPosition = child->layer()->staticInlinePosition() + containerLogicalWidth + containerBlock->borderLogicalRight(); 2119 staticPosition -= enclosingBox->logicalWidth(); 2120 for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->parent()) { 2121 if (curr->isBox()) 2122 staticPosition -= toRenderBox(curr)->logicalLeft(); 2123 } 2124 logicalRight.setValue(Fixed, staticPosition); 2125 } 2100 2126 } 2101 2127 … … 2178 2204 // see FIXME 2 2179 2205 // Calculate the static distance if needed. 2180 // FIXME: The static distance computation has not been patched for writing modes yet. 2181 if (logicalLeft.isAuto() && logicalRight.isAuto()) { 2182 if (containerDirection == LTR) { 2183 // 'staticX' should already have been set through layout of the parent. 2184 int staticPosition = layer()->staticX() - containerBlock->borderLeft(); 2185 for (RenderObject* curr = parent(); curr && curr != containerBlock; curr = curr->parent()) { 2186 if (curr->isBox()) 2187 staticPosition += toRenderBox(curr)->x(); 2188 } 2189 logicalLeft.setValue(Fixed, staticPosition); 2190 } else { 2191 RenderBox* enclosingBox = parent()->enclosingBox(); 2192 // 'staticX' should already have been set through layout of the parent. 2193 int staticPosition = layer()->staticX() + containerLogicalWidth + containerBlock->borderRight(); 2194 staticPosition -= enclosingBox->width(); 2195 for (RenderObject* curr = enclosingBox; curr && curr != containerBlock; curr = curr->parent()) { 2196 if (curr->isBox()) 2197 staticPosition -= toRenderBox(curr)->x(); 2198 } 2199 logicalRight.setValue(Fixed, staticPosition); 2200 } 2201 } 2202 2206 computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock, containerLogicalWidth, containerDirection); 2207 2203 2208 // Calculate constraint equation values for 'width' case. 2204 2209 int logicalWidthResult; … … 2448 2453 } 2449 2454 2455 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBottom, const RenderBox* child, const RenderBoxModelObject* containerBlock) 2456 { 2457 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) 2458 return; 2459 2460 // FIXME: The static distance computation has not been patched for mixed writing modes. 2461 int staticLogicalTop = child->layer()->staticBlockPosition() - containerBlock->borderBefore(); 2462 for (RenderObject* curr = child->parent(); curr && curr != containerBlock; curr = curr->parent()) { 2463 if (curr->isBox() && !curr->isTableRow()) 2464 staticLogicalTop += toRenderBox(curr)->logicalTop(); 2465 } 2466 logicalTop.setValue(Fixed, staticLogicalTop); 2467 } 2468 2450 2469 void RenderBox::computePositionedLogicalHeight() 2451 2470 { … … 2497 2516 // see FIXME 2 2498 2517 // Calculate the static distance if needed. 2499 // FIXME: The static distance computation has not been patched for writing modes. 2500 if (logicalTop.isAuto() && logicalBottom.isAuto()) { 2501 // staticY should already have been set through layout of the parent() 2502 int staticTop = layer()->staticY() - containerBlock->borderTop(); 2503 for (RenderObject* po = parent(); po && po != containerBlock; po = po->parent()) { 2504 if (po->isBox() && !po->isTableRow()) 2505 staticTop += toRenderBox(po)->y(); 2506 } 2507 logicalTop.setValue(Fixed, staticTop); 2508 } 2509 2518 computeBlockStaticDistance(logicalTop, logicalBottom, this, containerBlock); 2510 2519 2511 2520 int logicalHeightResult; // Needed to compute overflow. … … 2748 2757 \*-----------------------------------------------------------------------*/ 2749 2758 // see FIXME 2 2750 // FIXME: Static position computation has not been patched for writing modes yet. 2751 if (logicalLeft.isAuto() && logicalRight.isAuto()) { 2752 // see FIXME 1 2753 if (containerDirection == LTR) { 2754 // 'staticX' should already have been set through layout of the parent. 2755 int staticPosition = layer()->staticX() - containerBlock->borderLeft(); 2756 for (RenderObject* po = parent(); po && po != containerBlock; po = po->parent()) { 2757 if (po->isBox()) 2758 staticPosition += toRenderBox(po)->x(); 2759 } 2760 logicalLeft.setValue(Fixed, staticPosition); 2761 } else { 2762 RenderObject* po = parent(); 2763 // 'staticX' should already have been set through layout of the parent. 2764 int staticPosition = layer()->staticX() + containerLogicalWidth + containerBlock->borderRight(); 2765 for ( ; po && po != containerBlock; po = po->parent()) { 2766 if (po->isBox()) 2767 staticPosition += toRenderBox(po)->x(); 2768 } 2769 logicalRight.setValue(Fixed, staticPosition); 2770 } 2771 } 2759 computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock, containerLogicalWidth, containerDirection); 2772 2760 2773 2761 /*-----------------------------------------------------------------------*\ … … 2930 2918 \*-----------------------------------------------------------------------*/ 2931 2919 // see FIXME 2 2932 // FIXME: The static distance computation has not been patched for writing modes yet. 2933 if (logicalTop.isAuto() && logicalBottom.isAuto()) { 2934 // staticY should already have been set through layout of the parent(). 2935 int staticTop = layer()->staticY() - containerBlock->borderTop(); 2936 for (RenderObject* po = parent(); po && po != containerBlock; po = po->parent()) { 2937 if (po->isBox() && !po->isTableRow()) 2938 staticTop += toRenderBox(po)->y(); 2939 } 2940 logicalTop.setValue(Fixed, staticTop); 2941 } 2920 computeBlockStaticDistance(logicalTop, logicalBottom, this, containerBlock); 2942 2921 2943 2922 /*-----------------------------------------------------------------------*\ -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r76083 r79930 90 90 int borderAndPaddingLogicalHeight() const { return borderBefore() + borderAfter() + paddingBefore() + paddingAfter(); } 91 91 int borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); } 92 int borderAndPaddingLogicalLeft() const { return style()->isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 93 94 int borderAndPaddingStart() const { return borderStart() + paddingStart(); } 95 int borderLogicalLeft() const { return style()->isHorizontalWritingMode() ? borderLeft() : borderTop(); } 96 int borderLogicalRight() const { return style()->isHorizontalWritingMode() ? borderRight() : borderBottom(); } 92 97 93 98 virtual int marginTop() const = 0; -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r79286 r79930 413 413 if (child->isPositioned()) { 414 414 child->containingBlock()->insertPositionedObject(child); 415 if (child->style()->hasStaticX()) { 416 if (style()->isLeftToRightDirection()) 417 child->layer()->setStaticX(xPos); 418 else child->layer()->setStaticX(width() - xPos); 419 } 420 if (child->style()->hasStaticY()) { 421 RenderLayer* childLayer = child->layer(); 422 if (childLayer->staticY() != yPos) { 423 child->layer()->setStaticY(yPos); 415 RenderLayer* childLayer = child->layer(); 416 if (child->style()->hasStaticInlinePosition(style()->isHorizontalWritingMode())) 417 childLayer->setStaticInlinePosition(xPos); 418 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode())) { 419 if (childLayer->staticBlockPosition() != yPos) { 420 childLayer->setStaticBlockPosition(yPos); 424 421 child->setChildNeedsLayout(true, false); 425 422 } … … 679 676 if (child->isPositioned()) { 680 677 child->containingBlock()->insertPositionedObject(child); 681 if (child->style()->hasStaticX()) { 678 RenderLayer* childLayer = child->layer(); 679 if (child->style()->hasStaticInlinePosition(style()->isHorizontalWritingMode())) { 682 680 if (style()->isLeftToRightDirection()) 683 child ->layer()->setStaticX(borderLeft()+paddingLeft());681 childLayer->setStaticInlinePosition(borderLeft() + paddingLeft()); 684 682 else 685 child ->layer()->setStaticX(borderRight()+paddingRight());683 childLayer->setStaticInlinePosition(borderRight() + paddingRight()); 686 684 } 687 if (child->style()->hasStaticY()) { 688 RenderLayer* childLayer = child->layer(); 689 if (childLayer->staticY() != height()) { 690 child->layer()->setStaticY(height()); 685 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode())) { 686 if (childLayer->staticBlockPosition() != height()) { 687 childLayer->setStaticBlockPosition(height()); 691 688 child->setChildNeedsLayout(true, false); 692 689 } -
trunk/Source/WebCore/rendering/RenderInline.cpp
r79734 r79930 929 929 IntSize RenderInline::relativePositionedInlineOffset(const RenderBox* child) const 930 930 { 931 // FIXME: This function isn't right with mixed writing modes. 932 931 933 ASSERT(isRelPositioned()); 932 934 if (!isRelPositioned()) … … 937 939 // relative to the inline itself. 938 940 939 IntSize offset;940 int sx;941 int sy;941 IntSize logicalOffset; 942 int inlinePosition; 943 int blockPosition; 942 944 if (firstLineBox()) { 943 sx = firstLineBox()->x();944 sy = firstLineBox()->y();945 inlinePosition = lroundf(firstLineBox()->logicalLeft()); 946 blockPosition = firstLineBox()->logicalTop(); 945 947 } else { 946 sx = layer()->staticX(); 947 sy = layer()->staticY(); 948 } 949 950 if (!child->style()->hasStaticX()) 951 offset.setWidth(sx); 948 inlinePosition = layer()->staticInlinePosition(); 949 blockPosition = layer()->staticBlockPosition(); 950 } 951 952 if (!child->style()->hasStaticInlinePosition(style()->isHorizontalWritingMode())) 953 logicalOffset.setWidth(inlinePosition); 954 952 955 // This is not terribly intuitive, but we have to match other browsers. Despite being a block display type inside 953 956 // an inline, we still keep our x locked to the left of the relative positioned inline. Arguably the correct … … 956 959 else if (!child->style()->isOriginalDisplayInlineType()) 957 960 // Avoid adding in the left border/padding of the containing block twice. Subtract it out. 958 offset.setWidth(sx - (child->containingBlock()->borderLeft() + child->containingBlock()->paddingLeft()));959 960 if (!child->style()->hasStatic Y())961 offset.setHeight(sy);962 963 return offset;961 logicalOffset.setWidth(inlinePosition - child->containingBlock()->borderAndPaddingLogicalLeft()); 962 963 if (!child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode())) 964 logicalOffset.setHeight(blockPosition); 965 966 return style()->isHorizontalWritingMode() ? logicalOffset : logicalOffset.transposedSize(); 964 967 } 965 968 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r79360 r79930 177 177 #endif 178 178 , m_marquee(0) 179 , m_static X(0)180 , m_static Y(0)179 , m_staticInlinePosition(0) 180 , m_staticBlockPosition(0) 181 181 , m_reflection(0) 182 182 , m_scrollCorner(0) -
trunk/Source/WebCore/rendering/RenderLayer.h
r78618 r79930 398 398 void setNeedsFullRepaint(bool f = true) { m_needsFullRepaint = f; } 399 399 400 int static X() const { return m_staticX; }401 int static Y() const { return m_staticY; }402 void setStatic X(int staticX) { m_staticX = staticX; }403 void setStatic Y(int staticY) { m_staticY = staticY; }400 int staticInlinePosition() const { return m_staticInlinePosition; } 401 int staticBlockPosition() const { return m_staticBlockPosition; } 402 void setStaticInlinePosition(int position) { m_staticInlinePosition = position; } 403 void setStaticBlockPosition(int position) { m_staticBlockPosition = position; } 404 404 405 405 bool hasTransform() const { return renderer()->hasTransform(); } … … 695 695 696 696 // Cached normal flow values for absolute positioned elements with static left/top values. 697 int m_static X;698 int m_static Y;697 int m_staticInlinePosition; 698 int m_staticBlockPosition; 699 699 700 700 OwnPtr<TransformationMatrix> m_transform; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r79733 r79930 381 381 // Whether or not a positioned element requires normal flow x/y to be computed 382 382 // to determine its position. 383 bool hasStaticX() const { return left().isAuto() && right().isAuto(); } 384 bool hasStaticY() const { return top().isAuto() && bottom().isAuto(); } 383 bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); } 384 bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); } 385 bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); } 386 bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); } 385 387 386 388 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
Note:
See TracChangeset
for help on using the changeset viewer.