Changeset 70172 in webkit
- Timestamp:
- Oct 20, 2010 1:51:40 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70170 r70172 1 2010-10-20 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48001 6 7 Make boxes place themselves properly in the block direction. Get basic painting working for spans and add a test that 8 verifies that span painting and replaced element painting (like images) works correctly. 9 10 Added fast/blockflow/basic-vertical-line.html 11 12 * fast/blockflow/basic-vertical-line.html: Added. 13 * platform/mac/fast/blockflow/basic-vertical-line-expected.checksum: Added. 14 * platform/mac/fast/blockflow/basic-vertical-line-expected.png: Added. 15 * platform/mac/fast/blockflow/basic-vertical-line-expected.txt: Added. 16 1 17 2010-10-20 Beth Dakin <bdakin@apple.com> 2 18 -
trunk/WebCore/ChangeLog
r70170 r70172 1 2010-10-20 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48001 6 7 Make boxes place themselves properly in the block direction. Get basic painting working for spans and add a test that 8 verifies that span painting and replaced element painting (like images) works correctly. 9 10 Added fast/blockflow/basic-vertical-line.html 11 12 * rendering/InlineBox.cpp: 13 (WebCore::InlineBox::logicalHeight): 14 * rendering/InlineFlowBox.cpp: 15 (WebCore::InlineFlowBox::placeBoxesInInlineDirection): 16 (WebCore::InlineFlowBox::adjustMaxAscentAndDescent): 17 (WebCore::verticalPositionForBox): 18 (WebCore::InlineFlowBox::computeLogicalBoxHeights): 19 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): 20 (WebCore::InlineFlowBox::flipLinesInBlockDirection): 21 (WebCore::InlineFlowBox::paintBoxDecorations): 22 (WebCore::InlineFlowBox::paintMask): 23 * rendering/InlineFlowBox.h: 24 * rendering/style/RenderStyle.h: 25 (WebCore::InheritedFlags::isFlippedLinesWritingMode): 26 1 27 2010-10-20 Beth Dakin <bdakin@apple.com> 2 28 -
trunk/WebCore/rendering/InlineBox.cpp
r68177 r70172 96 96 return m_isText ? renderer()->style(m_firstLine)->font().height() : 0; 97 97 if (renderer()->isBox() && parent()) 98 return toRenderBox(m_renderer)->height();98 return m_isVertical ? toRenderBox(m_renderer)->width() : toRenderBox(m_renderer)->height(); 99 99 100 100 ASSERT(isInlineFlowBox()); … … 103 103 int result = font.height(); 104 104 if (parent()) 105 result += flowObject->borderAndPadding Height();105 result += flowObject->borderAndPaddingLogicalHeight(); 106 106 return result; 107 107 } -
trunk/WebCore/rendering/InlineFlowBox.cpp
r70072 r70172 333 333 334 334 logicalLeft += logicalLeftMargin; 335 curr->set X(logicalLeft);335 curr->setLogicalLeft(logicalLeft); 336 336 337 337 RenderBox* box = toRenderBox(curr->renderer()); … … 368 368 if (curr->renderer()->isPositioned()) 369 369 continue; // Positioned placeholders don't affect calculations. 370 if (curr-> y() == PositionTop || curr->y() == PositionBottom) {370 if (curr->logicalTop() == PositionTop || curr->logicalTop() == PositionBottom) { 371 371 int lineHeight = curr->lineHeight(); 372 if (curr-> y() == PositionTop) {372 if (curr->logicalTop() == PositionTop) { 373 373 if (maxAscent + maxDescent < lineHeight) 374 374 maxDescent = lineHeight - maxAscent; … … 391 391 { 392 392 if (curr->renderer()->isText()) 393 return curr->parent()-> y();393 return curr->parent()->logicalTop(); 394 394 if (curr->renderer()->isBox()) 395 395 return toRenderBox(curr->renderer())->verticalPosition(firstLine); … … 460 460 } 461 461 462 curr->set Y(verticalPositionForBox(curr, m_firstLine));463 if (curr-> y() == PositionTop) {462 curr->setLogicalTop(verticalPositionForBox(curr, m_firstLine)); 463 if (curr->logicalTop() == PositionTop) { 464 464 if (maxPositionTop < lineHeight) 465 465 maxPositionTop = lineHeight; 466 } else if (curr-> y() == PositionBottom) {466 } else if (curr->logicalTop() == PositionBottom) { 467 467 if (maxPositionBottom < lineHeight) 468 468 maxPositionBottom = lineHeight; 469 469 } else if ((!isInlineFlow || static_cast<InlineFlowBox*>(curr)->hasTextChildren()) || curr->boxModelObject()->hasInlineDirectionBordersOrPadding() || strictMode) { 470 int ascent = baseline - curr-> y();470 int ascent = baseline - curr->logicalTop(); 471 471 int descent = lineHeight - ascent; 472 472 if (maxAscent < ascent) … … 481 481 } 482 482 483 void InlineFlowBox::placeBoxesInBlockDirection(int yPos, int maxHeight, int maxAscent, bool strictMode, int& selectionTop, int& selectionBottom)483 void InlineFlowBox::placeBoxesInBlockDirection(int top, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom) 484 484 { 485 485 if (isRootInlineBox()) 486 set Y(yPos+ maxAscent - baselinePosition()); // Place our root box.486 setLogicalTop(top + maxAscent - baselinePosition()); // Place our root box. 487 487 488 488 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { … … 494 494 bool isInlineFlow = curr->isInlineFlowBox(); 495 495 if (isInlineFlow) 496 static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection( yPos, maxHeight, maxAscent, strictMode, selectionTop, selectionBottom);496 static_cast<InlineFlowBox*>(curr)->placeBoxesInBlockDirection(top, maxHeight, maxAscent, strictMode, lineTop, lineBottom); 497 497 498 498 bool childAffectsTopBottomPos = true; 499 if (curr-> y() == PositionTop)500 curr->set Y(yPos);501 else if (curr-> y() == PositionBottom)502 curr->set Y(yPos+ maxHeight - curr->lineHeight());499 if (curr->logicalTop() == PositionTop) 500 curr->setLogicalTop(top); 501 else if (curr->logicalTop() == PositionBottom) 502 curr->setLogicalTop(top + maxHeight - curr->lineHeight()); 503 503 else { 504 504 if ((isInlineFlow && !static_cast<InlineFlowBox*>(curr)->hasTextChildren()) && !curr->boxModelObject()->hasInlineDirectionBordersOrPadding() && !strictMode) 505 505 childAffectsTopBottomPos = false; 506 506 int posAdjust = maxAscent - curr->baselinePosition(); 507 curr->set Y(curr->y() + yPos+ posAdjust);507 curr->setLogicalTop(curr->logicalTop() + top + posAdjust); 508 508 } 509 509 510 int new Y = curr->y();510 int newLogicalTop = curr->logicalTop(); 511 511 if (curr->isText() || curr->isInlineFlowBox()) { 512 512 const Font& font = curr->renderer()->style(m_firstLine)->font(); 513 newY += curr->baselinePosition() - font.ascent(); 514 if (curr->isInlineFlowBox()) 515 newY -= curr->boxModelObject()->borderTop() + curr->boxModelObject()->paddingTop(); 513 newLogicalTop += curr->baselinePosition() - font.ascent(); 514 if (curr->isInlineFlowBox()) { 515 RenderBoxModelObject* boxObject = toRenderBoxModelObject(curr->renderer()); 516 newLogicalTop -= boxObject->style(m_firstLine)->isHorizontalWritingMode() ? boxObject->borderTop() + boxObject->paddingTop() : 517 boxObject->borderRight() + boxObject->paddingRight(); 518 } 516 519 } else if (!curr->renderer()->isBR()) { 517 520 RenderBox* box = toRenderBox(curr->renderer()); 518 new Y += box->marginTop();519 } 520 521 curr->set Y(newY);521 newLogicalTop += box->style(m_firstLine)->isHorizontalWritingMode() ? box->marginTop() : box->marginRight(); 522 } 523 524 curr->setLogicalTop(newLogicalTop); 522 525 523 526 if (childAffectsTopBottomPos) { 524 527 int boxHeight = curr->logicalHeight(); 525 selectionTop = min(selectionTop, newY);526 selectionBottom = max(selectionBottom, newY+ boxHeight);528 lineTop = min(lineTop, newLogicalTop); 529 lineBottom = max(lineBottom, newLogicalTop + boxHeight); 527 530 } 528 531 } … … 530 533 if (isRootInlineBox()) { 531 534 const Font& font = renderer()->style(m_firstLine)->font(); 532 setY(y() + baselinePosition() - font.ascent()); 535 setLogicalTop(logicalTop() + baselinePosition() - font.ascent()); 536 533 537 if (hasTextChildren() || strictMode) { 534 selectionTop = min(selectionTop, y()); 535 selectionBottom = max(selectionBottom, y() + logicalHeight()); 536 } 538 lineTop = min(lineTop, logicalTop()); 539 lineBottom = max(lineBottom, logicalTop() + logicalHeight()); 540 } 541 542 if (renderer()->style()->isFlippedLinesWritingMode()) 543 flipLinesInBlockDirection(lineTop, lineBottom); 544 } 545 } 546 547 void InlineFlowBox::flipLinesInBlockDirection(int lineTop, int lineBottom) 548 { 549 // Flip the box on the line such that the top is now relative to the lineBottom instead of the lineTop. 550 setLogicalTop(lineBottom - (logicalTop() - lineTop) - logicalHeight()); 551 552 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 553 if (curr->renderer()->isPositioned()) 554 continue; // Positioned placeholders aren't affected here. 555 556 if (curr->isInlineFlowBox()) 557 static_cast<InlineFlowBox*>(curr)->flipLinesInBlockDirection(lineTop, lineBottom); 558 else 559 curr->setLogicalTop(lineBottom - (curr->logicalTop() - lineTop) - curr->logicalHeight()); 537 560 } 538 561 } … … 763 786 int x = m_x; 764 787 int y = m_y; 765 int w = logicalWidth();766 int h = logicalHeight();788 int w = m_isVertical ? logicalHeight() : logicalWidth(); 789 int h = m_isVertical ? logicalWidth() : logicalHeight(); 767 790 768 791 // Constrain our background/border painting to the line top and bottom if necessary. … … 770 793 if (!hasTextChildren() && !noQuirksMode) { 771 794 RootInlineBox* rootBox = root(); 772 int bottom = min(rootBox->lineBottom(), y + h); 773 y = max(rootBox->lineTop(), y); 774 h = bottom - y; 795 int& top = m_isVertical ? x : y; 796 int& logicalHeight = m_isVertical ? w : h; 797 int bottom = min(rootBox->lineBottom(), top + logicalHeight); 798 top = max(rootBox->lineTop(), top); 799 logicalHeight = bottom - top; 775 800 } 776 801 … … 839 864 int x = m_x; 840 865 int y = m_y; 841 int w = logicalWidth();842 int h = logicalHeight();866 int w = m_isVertical ? logicalHeight() : logicalWidth(); 867 int h = m_isVertical ? logicalWidth() : logicalHeight(); 843 868 844 869 // Constrain our background/border painting to the line top and bottom if necessary. … … 846 871 if (!hasTextChildren() && !noQuirksMode) { 847 872 RootInlineBox* rootBox = root(); 848 int bottom = min(rootBox->lineBottom(), y + h); 849 y = max(rootBox->lineTop(), y); 850 h = bottom - y; 873 int& top = m_isVertical ? x : y; 874 int& logicalHeight = m_isVertical ? w : h; 875 int bottom = min(rootBox->lineBottom(), top + logicalHeight); 876 top = max(rootBox->lineTop(), top); 877 logicalHeight = bottom - top; 851 878 } 852 879 -
trunk/WebCore/rendering/InlineFlowBox.h
r69341 r70172 155 155 int getFlowSpacingLogicalWidth(); 156 156 bool onEndChain(RenderObject* endObject); 157 int placeBoxesInInlineDirection(int x, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&);157 int placeBoxesInInlineDirection(int logicalLeft, bool& needsWordSpacing, GlyphOverflowAndFallbackFontsMap&); 158 158 void computeLogicalBoxHeights(int& maxPositionTop, int& maxPositionBottom, 159 159 int& maxAscent, int& maxDescent, bool strictMode, GlyphOverflowAndFallbackFontsMap&); 160 160 void adjustMaxAscentAndDescent(int& maxAscent, int& maxDescent, 161 161 int maxPositionTop, int maxPositionBottom); 162 void placeBoxesInBlockDirection(int y, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom); 162 void placeBoxesInBlockDirection(int logicalTop, int maxHeight, int maxAscent, bool strictMode, int& lineTop, int& lineBottom); 163 void flipLinesInBlockDirection(int lineTop, int lineBottom); 163 164 void computeBlockDirectionOverflow(int lineTop, int lineBottom, bool strictMode, GlyphOverflowAndFallbackFontsMap&); 164 165 -
trunk/WebCore/rendering/style/RenderStyle.h
r69341 r70172 752 752 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); } 753 753 bool isHorizontalWritingMode() const { return writingMode() == TopToBottomWritingMode || writingMode() == BottomToTopWritingMode; } 754 bool isFlippedLinesWritingMode() const { return writingMode() == LeftToRightWritingMode || writingMode() == BottomToTopWritingMode; } 754 755 755 756 ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); }
Note: See TracChangeset
for help on using the changeset viewer.