Changeset 79618 in webkit
- Timestamp:
- Feb 24, 2011 2:08:55 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 52 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r79617 r79618 1 2011-02-24 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=46500, make positioned elements work with vertical text. 6 7 Rework the logical height computation for positioned elements to work in terms of before and after. That way the offset is determined from 8 the correct container side in flipped block writing modes (e.g., vertical-rl). 9 10 Patch locationOffsetIncludingFlipping to use the containing block to flip so that it will behave correctly with absolute/fixed positioned 11 elements. 12 13 Patch offsetFromContainer to use the flipped location offset for absolute/fixed positioned elements so that localToAbsolute works properly. 14 15 Added twelve tests in fast/block/positioning/vertical-rl and fast/block/positioning/vertical-lr. 16 17 * fast/block/positioning/vertical-lr: Added. 18 * fast/block/positioning/vertical-lr/001.html: Added. 19 * fast/block/positioning/vertical-lr/002.html: Added. 20 * fast/block/positioning/vertical-lr/003.html: Added. 21 * fast/block/positioning/vertical-lr/004.html: Added. 22 * fast/block/positioning/vertical-lr/005.html: Added. 23 * fast/block/positioning/vertical-lr/006.html: Added. 24 * fast/block/positioning/vertical-rl: Added. 25 * fast/block/positioning/vertical-rl/001.html: Added. 26 * fast/block/positioning/vertical-rl/002.html: Added. 27 * fast/block/positioning/vertical-rl/003.html: Added. 28 * fast/block/positioning/vertical-rl/004.html: Added. 29 * fast/block/positioning/vertical-rl/005.html: Added. 30 * fast/block/positioning/vertical-rl/006.html: Added. 31 * platform/mac/fast/block/positioning/vertical-lr: Added. 32 * platform/mac/fast/block/positioning/vertical-lr/001-expected.checksum: Added. 33 * platform/mac/fast/block/positioning/vertical-lr/001-expected.png: Added. 34 * platform/mac/fast/block/positioning/vertical-lr/001-expected.txt: Added. 35 * platform/mac/fast/block/positioning/vertical-lr/002-expected.checksum: Added. 36 * platform/mac/fast/block/positioning/vertical-lr/002-expected.png: Added. 37 * platform/mac/fast/block/positioning/vertical-lr/002-expected.txt: Added. 38 * platform/mac/fast/block/positioning/vertical-lr/003-expected.checksum: Added. 39 * platform/mac/fast/block/positioning/vertical-lr/003-expected.png: Added. 40 * platform/mac/fast/block/positioning/vertical-lr/003-expected.txt: Added. 41 * platform/mac/fast/block/positioning/vertical-lr/004-expected.checksum: Added. 42 * platform/mac/fast/block/positioning/vertical-lr/004-expected.png: Added. 43 * platform/mac/fast/block/positioning/vertical-lr/004-expected.txt: Added. 44 * platform/mac/fast/block/positioning/vertical-lr/005-expected.checksum: Added. 45 * platform/mac/fast/block/positioning/vertical-lr/005-expected.png: Added. 46 * platform/mac/fast/block/positioning/vertical-lr/005-expected.txt: Added. 47 * platform/mac/fast/block/positioning/vertical-lr/006-expected.checksum: Added. 48 * platform/mac/fast/block/positioning/vertical-lr/006-expected.png: Added. 49 * platform/mac/fast/block/positioning/vertical-lr/006-expected.txt: Added. 50 * platform/mac/fast/block/positioning/vertical-rl: Added. 51 * platform/mac/fast/block/positioning/vertical-rl/001-expected.checksum: Added. 52 * platform/mac/fast/block/positioning/vertical-rl/001-expected.png: Added. 53 * platform/mac/fast/block/positioning/vertical-rl/001-expected.txt: Added. 54 * platform/mac/fast/block/positioning/vertical-rl/002-expected.checksum: Added. 55 * platform/mac/fast/block/positioning/vertical-rl/002-expected.png: Added. 56 * platform/mac/fast/block/positioning/vertical-rl/002-expected.txt: Added. 57 * platform/mac/fast/block/positioning/vertical-rl/003-expected.checksum: Added. 58 * platform/mac/fast/block/positioning/vertical-rl/003-expected.png: Added. 59 * platform/mac/fast/block/positioning/vertical-rl/003-expected.txt: Added. 60 * platform/mac/fast/block/positioning/vertical-rl/004-expected.checksum: Added. 61 * platform/mac/fast/block/positioning/vertical-rl/004-expected.png: Added. 62 * platform/mac/fast/block/positioning/vertical-rl/004-expected.txt: Added. 63 * platform/mac/fast/block/positioning/vertical-rl/005-expected.checksum: Added. 64 * platform/mac/fast/block/positioning/vertical-rl/005-expected.png: Added. 65 * platform/mac/fast/block/positioning/vertical-rl/005-expected.txt: Added. 66 * platform/mac/fast/block/positioning/vertical-rl/006-expected.checksum: Added. 67 * platform/mac/fast/block/positioning/vertical-rl/006-expected.png: Added. 68 * platform/mac/fast/block/positioning/vertical-rl/006-expected.txt: Added. 69 1 70 2011-02-24 Kenneth Russell <kbr@google.com> 2 71 -
trunk/Source/WebCore/ChangeLog
r79616 r79618 1 2011-02-24 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=46500, make positioned elements work with vertical text. 6 7 Rework the logical height computation for positioned elements to work in terms of before and after. That way the offset is determined from 8 the correct container side in flipped block writing modes (e.g., vertical-rl). 9 10 Patch locationOffsetIncludingFlipping to use the containing block to flip so that it will behave correctly with absolute/fixed positioned 11 elements. 12 13 Patch offsetFromContainer to use the flipped location offset for absolute/fixed positioned elements so that localToAbsolute works properly. 14 15 Added twelve tests in fast/block/positioning/vertical-rl and fast/block/positioning/vertical-lr. 16 17 * rendering/RenderBox.cpp: 18 (WebCore::RenderBox::offsetFromContainer): 19 (WebCore::RenderBox::computePositionedLogicalHeight): 20 (WebCore::RenderBox::computePositionedLogicalHeightUsing): 21 (WebCore::RenderBox::locationOffsetIncludingFlipping): 22 * rendering/style/RenderStyle.h: 23 (WebCore::InheritedFlags::logicalTop): 24 (WebCore::InheritedFlags::logicalBottom): 25 1 26 2011-02-23 Oliver Hunt <oliver@apple.com> 2 27 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r79497 r79618 1276 1276 offset += locationOffsetIncludingFlipping(); 1277 1277 } else 1278 offset += locationOffset ();1278 offset += locationOffsetIncludingFlipping(); 1279 1279 } 1280 1280 … … 2459 2459 2460 2460 bool isHorizontal = style()->isHorizontalWritingMode(); 2461 bool isFlipped = style()->isFlippedBlocksWritingMode(); 2461 2462 const int bordersPlusPadding = borderAndPaddingLogicalHeight(); 2462 const Length margin LogicalTop = isHorizontal ? style()->marginTop() : style()->marginLeft();2463 const Length margin LogicalBottom = isHorizontal ? style()->marginBottom() : style()->marginRight();2464 int& margin LogicalTopAlias = isHorizontal ? m_marginTop : m_marginLeft;2465 int& margin LogicalBottomAlias = isHorizontal ? m_marginBottom : m_marginRight;2463 const Length marginBefore = style()->marginBefore(); 2464 const Length marginAfter = style()->marginAfter(); 2465 int& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft); 2466 int& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight); 2466 2467 2467 2468 Length logicalTop = style()->logicalTop(); 2468 2469 Length logicalBottom = style()->logicalBottom(); 2469 2470 2470 2471 /*---------------------------------------------------------------------------*\ 2471 2472 * For the purposes of this section and the next, the term "static position" … … 2504 2505 // Calculate constraint equation values for 'height' case. 2505 2506 computePositionedLogicalHeightUsing(style()->logicalHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2506 logicalTop, logicalBottom, margin LogicalTop, marginLogicalBottom,2507 logicalHeightResult, margin LogicalTopAlias, marginLogicalBottomAlias, logicalTopPos);2507 logicalTop, logicalBottom, marginBefore, marginAfter, 2508 logicalHeightResult, marginBeforeAlias, marginAfterAlias, logicalTopPos); 2508 2509 setLogicalTop(logicalTopPos); 2509 2510 … … 2514 2515 if (!style()->logicalMaxHeight().isUndefined()) { 2515 2516 int maxLogicalHeight; 2516 int maxMargin LogicalTop;2517 int maxMargin LogicalBottom;2517 int maxMarginBefore; 2518 int maxMarginAfter; 2518 2519 int maxLogicalTopPos; 2519 2520 2520 2521 computePositionedLogicalHeightUsing(style()->logicalMaxHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2521 logicalTop, logicalBottom, margin LogicalTop, marginLogicalBottom,2522 maxLogicalHeight, maxMargin LogicalTop, maxMarginLogicalBottom, maxLogicalTopPos);2522 logicalTop, logicalBottom, marginBefore, marginAfter, 2523 maxLogicalHeight, maxMarginBefore, maxMarginAfter, maxLogicalTopPos); 2523 2524 2524 2525 if (logicalHeightResult > maxLogicalHeight) { 2525 2526 logicalHeightResult = maxLogicalHeight; 2526 margin LogicalTopAlias = maxMarginLogicalTop;2527 margin LogicalBottomAlias = maxMarginLogicalBottom;2527 marginBeforeAlias = maxMarginBefore; 2528 marginAfterAlias = maxMarginAfter; 2528 2529 setLogicalTop(maxLogicalTopPos); 2529 2530 } … … 2533 2534 if (!style()->logicalMinHeight().isZero()) { 2534 2535 int minLogicalHeight; 2535 int minMargin LogicalTop;2536 int minMargin LogicalBottom;2536 int minMarginBefore; 2537 int minMarginAfter; 2537 2538 int minLogicalTopPos; 2538 2539 2539 2540 computePositionedLogicalHeightUsing(style()->logicalMinHeight(), containerBlock, containerLogicalHeight, bordersPlusPadding, 2540 logicalTop, logicalBottom, margin LogicalTop, marginLogicalBottom,2541 minLogicalHeight, minMargin LogicalTop, minMarginLogicalBottom, minLogicalTopPos);2541 logicalTop, logicalBottom, marginBefore, marginAfter, 2542 minLogicalHeight, minMarginBefore, minMarginAfter, minLogicalTopPos); 2542 2543 2543 2544 if (logicalHeightResult < minLogicalHeight) { 2544 2545 logicalHeightResult = minLogicalHeight; 2545 margin LogicalTopAlias = minMarginLogicalTop;2546 margin LogicalBottomAlias = minMarginLogicalBottom;2546 marginBeforeAlias = minMarginBefore; 2547 marginAfterAlias = minMarginAfter; 2547 2548 setLogicalTop(minLogicalTopPos); 2548 2549 } … … 2555 2556 void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock, 2556 2557 int containerLogicalHeight, int bordersPlusPadding, 2557 Length logicalTop, Length logicalBottom, Length margin LogicalTop, Length marginLogicalBottom,2558 int& logicalHeightValue, int& margin LogicalTopValue, int& marginLogicalBottomValue, int& logicalTopPos)2558 Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, 2559 int& logicalHeightValue, int& marginBeforeValue, int& marginAfterValue, int& logicalTopPos) 2559 2560 { 2560 2561 // 'top' and 'bottom' cannot both be 'auto' because 'top would of been … … 2594 2595 2595 2596 // Margins are now the only unknown 2596 if (margin LogicalTop.isAuto() && marginLogicalBottom.isAuto()) {2597 if (marginBefore.isAuto() && marginAfter.isAuto()) { 2597 2598 // Both margins auto, solve for equality 2598 2599 // NOTE: This may result in negative values. 2599 margin LogicalTopValue = availableSpace / 2; // split the difference2600 margin LogicalBottomValue = availableSpace - marginLogicalTopValue; // account for odd valued differences2601 } else if (margin LogicalTop.isAuto()) {2600 marginBeforeValue = availableSpace / 2; // split the difference 2601 marginAfterValue = availableSpace - marginBeforeValue; // account for odd valued differences 2602 } else if (marginBefore.isAuto()) { 2602 2603 // Solve for top margin 2603 margin LogicalBottomValue = marginLogicalBottom.calcValue(containerLogicalHeight);2604 margin LogicalTopValue = availableSpace - marginLogicalBottomValue;2605 } else if (margin LogicalBottom.isAuto()) {2604 marginAfterValue = marginAfter.calcValue(containerLogicalHeight); 2605 marginBeforeValue = availableSpace - marginAfterValue; 2606 } else if (marginAfter.isAuto()) { 2606 2607 // Solve for bottom margin 2607 margin LogicalTopValue = marginLogicalTop.calcValue(containerLogicalHeight);2608 margin LogicalBottomValue = availableSpace - marginLogicalTopValue;2608 marginBeforeValue = marginBefore.calcValue(containerLogicalHeight); 2609 marginAfterValue = availableSpace - marginBeforeValue; 2609 2610 } else { 2610 2611 // Over-constrained, (no need solve for bottom) 2611 margin LogicalTopValue = marginLogicalTop.calcValue(containerLogicalHeight);2612 margin LogicalBottomValue = marginLogicalBottom.calcValue(containerLogicalHeight);2612 marginBeforeValue = marginBefore.calcValue(containerLogicalHeight); 2613 marginAfterValue = marginAfter.calcValue(containerLogicalHeight); 2613 2614 } 2614 2615 } else { … … 2639 2640 2640 2641 // Calculate margins, 'auto' margins are ignored. 2641 margin LogicalTopValue = marginLogicalTop.calcMinValue(containerLogicalHeight);2642 margin LogicalBottomValue = marginLogicalBottom.calcMinValue(containerLogicalHeight);2643 2644 const int availableSpace = containerLogicalHeight - (margin LogicalTopValue + marginLogicalBottomValue + bordersPlusPadding);2642 marginBeforeValue = marginBefore.calcMinValue(containerLogicalHeight); 2643 marginAfterValue = marginAfter.calcMinValue(containerLogicalHeight); 2644 2645 const int availableSpace = containerLogicalHeight - (marginBeforeValue + marginAfterValue + bordersPlusPadding); 2645 2646 2646 2647 // Use rule/case that applies. … … 2672 2673 2673 2674 // Use computed values to calculate the vertical position. 2674 logicalTopPos = logicalTopValue ;2675 logicalTopPos = logicalTopValue + marginBeforeValue; 2675 2676 2676 2677 // Our offset is from the logical bottom edge in a flipped environment, e.g., right for vertical-rl and bottom for horizontal-bt. 2677 2678 if (style()->isFlippedBlocksWritingMode()) { 2678 logicalTopPos += marginLogicalBottomValue;2679 2679 if (style()->isHorizontalWritingMode()) 2680 2680 logicalTopPos += containerBlock->borderBottom(); … … 2682 2682 logicalTopPos += containerBlock->borderRight(); 2683 2683 } else { 2684 logicalTopPos += marginLogicalTopValue;2685 2684 if (style()->isHorizontalWritingMode()) 2686 2685 logicalTopPos += containerBlock->borderTop(); … … 3415 3414 IntSize RenderBox::locationOffsetIncludingFlipping() const 3416 3415 { 3417 if (!parent() || !parent()->isBox()) 3416 RenderBlock* containerBlock = containingBlock(); 3417 if (containerBlock == this) 3418 3418 return locationOffset(); 3419 3419 3420 3420 IntRect rect(frameRect()); 3421 parentBox()->flipForWritingMode(rect);3421 containerBlock->flipForWritingMode(rect); // FIXME: This is wrong if we are an absolutely positioned object enclosed by a relative-positioned inline. 3422 3422 return IntSize(rect.x(), rect.y()); 3423 3423 } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r79482 r79618 376 376 Length logicalLeft() const { return isHorizontalWritingMode() ? left() : top(); } 377 377 Length logicalRight() const { return isHorizontalWritingMode() ? right() : bottom(); } 378 Length logicalTop() const { return isHorizontalWritingMode() ? top() : left(); }379 Length logicalBottom() const { return isHorizontalWritingMode() ? bottom() : right(); }378 Length logicalTop() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? bottom() : top()) : (isFlippedBlocksWritingMode() ? right() : left()); } 379 Length logicalBottom() const { return isHorizontalWritingMode() ? (isFlippedBlocksWritingMode() ? top() : bottom()) : (isFlippedBlocksWritingMode() ? left() : right()); } 380 380 381 381 // Whether or not a positioned element requires normal flow x/y to be computed
Note: See TracChangeset
for help on using the changeset viewer.