Changeset 13595 in webkit
- Timestamp:
- Mar 30, 2006 9:23:14 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r13588 r13595 1 2006-03-30 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 Reviewed by Darin. 4 5 - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=7301 6 Text shadow does not repaint correctly 7 8 * fast/repaint: Added. 9 * fast/repaint/inline-block-overflow-expected.checksum: Added. 10 * fast/repaint/inline-block-overflow-expected.png: Added. 11 * fast/repaint/inline-block-overflow-expected.txt: Added. 12 * fast/repaint/inline-block-overflow.html: Added. 13 * fast/repaint/text-shadow-expected.checksum: Added. 14 * fast/repaint/text-shadow-expected.png: Added. 15 * fast/repaint/text-shadow-expected.txt: Added. 16 * fast/repaint/text-shadow-horizontal-expected.checksum: Added. 17 * fast/repaint/text-shadow-horizontal-expected.png: Added. 18 * fast/repaint/text-shadow-horizontal-expected.txt: Added. 19 * fast/repaint/text-shadow-horizontal.html: Added. 20 * fast/repaint/text-shadow.html: Added. 21 1 22 2006-03-30 Tim Omernick <timo@apple.com> 2 23 -
trunk/WebCore/ChangeLog
r13592 r13595 1 2006-03-30 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 3 Tests: fast/repaint/text-shadow.html fast/repaint/text-shadow-horizontal.html 4 5 Reviewed by Darin. 6 7 - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=7301 8 Text shadow does not repaint correctly 9 10 * rendering/InlineTextBox.cpp: 11 (WebCore::InlineTextBox::paint): Paint the text box if it is within the maximum 12 possible horizontal shadow overflow of the damage rect. 13 * rendering/InlineTextBox.h: Removed unused function checkVerticalPoint(). 14 * rendering/RenderFlow.cpp: 15 (WebCore::RenderFlow::paintLines): Use the vertical overflows instead of the 16 selection vertical bounds. 17 (WebCore::RenderFlow::hitTestLines): 18 * rendering/render_line.cpp: 19 (WebCore::InlineFlowBox::placeBoxesHorizontally): Include overflow due to text shadow 20 in leftPosition and rightPosition and keep track of the maximum horizontal shadow 21 on the inline. 22 (WebCore::InlineFlowBox::verticallyAlignBoxes): 23 (WebCore::InlineFlowBox::placeBoxesVertically): Include overflow due to shadow and 24 inline-blocks' overflow in topPosition and bottomPosition but not in the selection 25 vertical bounds. 26 (WebCore::RootInlineBox::selectionTop): 27 * rendering/render_line.h: 28 (WebCore::InlineFlowBox:::InlineRunBox): 29 (WebCore::InlineFlowBox::setVerticalSelectionPositions): 30 (WebCore::InlineFlowBox::maxHorizontalShadow): 31 (WebCore::RootInlineBox::setVerticalSelectionPositions): 32 (WebCore::RootInlineBox::selectionBottom): 33 (WebCore::RootInlineBox::selectionHeight): 34 1 35 2006-03-30 Beth Dakin <bdakin@apple.com> 2 36 -
trunk/WebCore/rendering/InlineTextBox.cpp
r13592 r13595 68 68 } 69 69 70 bool InlineTextBox::checkVerticalPoint(int _y, int _ty, int _h)71 {72 int topY = m_y;73 int bottomY = m_y + m_height;74 if (root()->hasSelectedChildren()) {75 topY = kMin(root()->selectionTop(), topY);76 bottomY = kMax(bottomY, root()->bottomOverflow());77 }78 if ((_ty + topY >= _y + _h) || (_ty + bottomY <= _y))79 return false;80 return true;81 }82 83 70 bool InlineTextBox::isSelected(int startPos, int endPos) const 84 71 { … … 251 238 assert(i.phase != PaintPhaseSelfOutline && i.phase != PaintPhaseChildOutlines); 252 239 253 int xPos = tx + m_x ;254 int w = width() ;240 int xPos = tx + m_x - parent()->maxHorizontalShadow(); 241 int w = width() + 2 * parent()->maxHorizontalShadow(); 255 242 if (xPos >= i.r.right() || xPos + w <= i.r.x()) 256 243 return; -
trunk/WebCore/rendering/InlineTextBox.h
r13393 r13595 120 120 int positionForOffset(int offset) const; 121 121 122 /**123 * if this text run was rendered @ref _ty pixels below the upper edge124 * of a view, would the @ref _y -coordinate be inside the vertical range125 * of this object's representation?126 */127 bool checkVerticalPoint(int _y, int _ty, int _h);128 129 122 int m_start; 130 123 unsigned short m_len; -
trunk/WebCore/rendering/RenderFlow.cpp
r13592 r13595 365 365 // We can check the first box and last box and avoid painting if we don't 366 366 // intersect. This is a quick short-circuit that we can take to avoid walking any lines. 367 // FIXME: This check is flawed in two extremely obscure ways. 368 // (1) If some line in the middle has a huge overflow, it might actually extend below the last line. 369 // (2) The overflow from an inline block on a line is not reported to the line. 370 int yPos = firstLineBox()->root()->selectionTop() - maximalOutlineSize(i.phase); 371 int h = maximalOutlineSize(i.phase) + lastLineBox()->root()->selectionTop() + lastLineBox()->root()->selectionHeight() - yPos; 367 // FIXME: This check is flawed in the following extremely obscure way: 368 // if some line in the middle has a huge overflow, it might actually extend below the last line. 369 int yPos = firstLineBox()->root()->topOverflow() - maximalOutlineSize(i.phase); 370 int h = maximalOutlineSize(i.phase) + lastLineBox()->root()->bottomOverflow() - yPos; 372 371 yPos += _ty; 373 372 if (yPos >= i.r.bottom() || yPos + h <= i.r.y()) … … 437 436 // We can check the first box and last box and avoid hit testing if we don't 438 437 // contain the point. This is a quick short-circuit that we can take to avoid walking any lines. 439 // FIXME: This check is flawed in two extremely obscure ways. 440 // (1) If some line in the middle has a huge overflow, it might actually extend below the last line. 441 // (2) The overflow from an inline block on a line is not reported to the line. 438 // FIXME: This check is flawed in the following extremely obscure way: 439 // if some line in the middle has a huge overflow, it might actually extend below the last line. 442 440 if ((y >= ty + lastLineBox()->root()->bottomOverflow()) || (y < ty + firstLineBox()->root()->topOverflow())) 443 441 return false; -
trunk/WebCore/rendering/render_line.cpp
r13592 r13595 478 478 } 479 479 text->setXPos(x); 480 leftPosition = kMin(x, leftPosition); 481 rightPosition = kMax(x + text->width(), rightPosition); 480 int shadowLeft = 0; 481 int shadowRight = 0; 482 for (ShadowData* shadow = rt->style()->textShadow(); shadow; shadow = shadow->next) { 483 shadowLeft = kMin(shadowLeft, shadow->x - shadow->blur); 484 shadowRight = kMax(shadowRight, shadow->x + shadow->blur); 485 } 486 leftPosition = kMin(x + shadowLeft, leftPosition); 487 rightPosition = kMax(x + text->width() + shadowRight, rightPosition); 488 m_maxHorizontalShadow = kMax(kMax(shadowRight, -shadowLeft), m_maxHorizontalShadow); 482 489 x += text->width(); 483 490 } … … 544 551 int topPosition = heightOfBlock; 545 552 int bottomPosition = heightOfBlock; 546 placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition); 553 int selectionTop = heightOfBlock; 554 int selectionBottom = heightOfBlock; 555 placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom); 547 556 548 557 setVerticalOverflowPositions(topPosition, bottomPosition); 558 setVerticalSelectionPositions(selectionTop, selectionBottom); 549 559 550 560 // Shrink boxes with no text children in quirks and almost strict mode. … … 635 645 636 646 void InlineFlowBox::placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, 637 int& topPosition, int& bottomPosition )647 int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom) 638 648 { 639 649 if (isRootInlineBox()) … … 647 657 // line-height). 648 658 if (curr->isInlineFlowBox()) 649 static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, 650 topPosition, bottomPosition); 659 static_cast<InlineFlowBox*>(curr)->placeBoxesVertically(y, maxHeight, maxAscent, strictMode, topPosition, bottomPosition, selectionTop, selectionBottom); 651 660 652 661 bool childAffectsTopBottomPos = true; … … 664 673 int newHeight = curr->height(); 665 674 int newBaseline = curr->baseline(); 675 int overflowTop = 0; 676 int overflowBottom = 0; 666 677 if (curr->isText() || curr->isInlineFlowBox()) { 667 678 const Font& font = curr->object()->font(m_firstLine); … … 669 680 newY += curr->baseline() - newBaseline; 670 681 newHeight = newBaseline + font.descent(); 682 for (ShadowData* shadow = curr->object()->style()->textShadow(); shadow; shadow = shadow->next) { 683 overflowTop = kMin(overflowTop, shadow->y - shadow->blur); 684 overflowBottom = kMax(overflowBottom, shadow->y + shadow->blur); 685 } 671 686 if (curr->isInlineFlowBox()) { 672 687 newHeight += curr->object()->borderTop() + curr->object()->paddingTop() + … … 679 694 newY += curr->object()->marginTop(); 680 695 newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom()); 696 overflowTop = curr->object()->overflowTop(); 697 overflowBottom = curr->object()->overflowHeight() - newHeight; 681 698 } 682 699 … … 686 703 687 704 if (childAffectsTopBottomPos) { 688 if (newY < topPosition)689 topPosition = newY;690 if (newY + newHeight > bottomPosition)691 bottomPosition = newY + newHeight;692 }705 selectionTop = kMin(selectionTop, newY); 706 selectionBottom = kMax(selectionBottom, newY + newHeight); 707 } 708 topPosition = kMin(topPosition, newY + overflowTop); 709 bottomPosition = kMax(bottomPosition, newY + newHeight + overflowBottom); 693 710 } 694 711 … … 699 716 setBaseline(font.ascent()); 700 717 if (hasTextChildren() || strictMode) { 701 if (yPos() < topPosition) 702 topPosition = yPos(); 703 if (yPos() + height() > bottomPosition) 704 bottomPosition = yPos() + height(); 718 selectionTop = kMin(selectionTop, yPos()); 719 selectionBottom = kMax(selectionBottom, yPos() + height()); 705 720 } 706 721 } … … 1299 1314 { 1300 1315 if (!prevRootBox()) 1301 return topOverflow();1302 1303 int prevBottom = prevRootBox()-> bottomOverflow();1304 if (prevBottom < m_ topOverflow&& block()->containsFloats()) {1316 return m_selectionTop; 1317 1318 int prevBottom = prevRootBox()->selectionBottom(); 1319 if (prevBottom < m_selectionTop && block()->containsFloats()) { 1305 1320 // This line has actually been moved further down, probably from a large line-height, but possibly because the 1306 1321 // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous … … 1308 1323 int prevLeft = block()->leftOffset(prevBottom); 1309 1324 int prevRight = block()->rightOffset(prevBottom); 1310 int newLeft = block()->leftOffset(m_ topOverflow);1311 int newRight = block()->rightOffset(m_ topOverflow);1325 int newLeft = block()->leftOffset(m_selectionTop); 1326 int newRight = block()->rightOffset(m_selectionTop); 1312 1327 if (prevLeft > newLeft || prevRight < newRight) 1313 return m_ topOverflow;1328 return m_selectionTop; 1314 1329 } 1315 1330 -
trunk/WebCore/rendering/render_line.h
r13393 r13595 211 211 m_includeLeftEdge = m_includeRightEdge = false; 212 212 m_hasTextChildren = false; 213 m_maxHorizontalShadow = 0; 213 214 } 214 215 … … 279 280 int maxPositionTop, int maxPositionBottom); 280 281 void placeBoxesVertically(int y, int maxHeight, int maxAscent, bool strictMode, 281 int& topPosition, int& bottomPosition );282 int& topPosition, int& bottomPosition, int& selectionTop, int& selectionBottom); 282 283 void shrinkBoxesWithNoTextChildren(int topPosition, int bottomPosition); 283 284 284 285 virtual void setVerticalOverflowPositions(int top, int bottom) {} 286 virtual void setVerticalSelectionPositions(int top, int bottom) {} 287 int maxHorizontalShadow() const { return m_maxHorizontalShadow; } 285 288 286 289 void removeChild(InlineBox* child); … … 294 297 InlineBox* m_firstChild; 295 298 InlineBox* m_lastChild; 299 int m_maxHorizontalShadow; 296 300 bool m_includeLeftEdge : 1; 297 301 bool m_includeRightEdge : 1; … … 322 326 virtual int rightOverflow() { return m_rightOverflow; } 323 327 virtual void setVerticalOverflowPositions(int top, int bottom) { m_topOverflow = top; m_bottomOverflow = bottom; } 328 virtual void setVerticalSelectionPositions(int top, int bottom) { m_selectionTop = top; m_selectionBottom = bottom; } 324 329 void setHorizontalOverflowPositions(int left, int right) { m_leftOverflow = left; m_rightOverflow = right; } 325 330 void setLineBreakInfo(RenderObject* obj, unsigned breakPos, BidiStatus* status, BidiContext* context); … … 365 370 366 371 int selectionTop(); 367 int selectionHeight() { return kMax(0, m_bottomOverflow - selectionTop()); } 372 int selectionBottom() { return m_selectionBottom; } 373 int selectionHeight() { return kMax(0, selectionBottom() - selectionTop()); } 368 374 369 375 InlineBox* closestLeafChildForXPos(int _x, int _tx); … … 378 384 int m_rightOverflow; 379 385 386 int m_selectionTop; 387 int m_selectionBottom; 388 380 389 // Where this line ended. The exact object and the position within that object are stored so that 381 390 // we can create a BidiIterator beginning just after the end of this line.
Note: See TracChangeset
for help on using the changeset viewer.