Changeset 21605 in webkit
- Timestamp:
- May 19, 2007 5:16:53 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r21604 r21605 1 2007-05-19 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Dave Hyatt. 4 5 - repaint tests and updated results for http://bugs.webkit.org/show_bug.cgi?id=12729 6 box-shadow disappears when scrolling a div that it falls on/under 7 8 * fast/box-shadow/basic-shadows-expected.checksum: 9 * fast/box-shadow/basic-shadows-expected.png: 10 * fast/box-shadow/basic-shadows-expected.txt: 11 * fast/repaint/box-shadow-dynamic-expected.checksum: Added. 12 * fast/repaint/box-shadow-dynamic-expected.png: Added. 13 * fast/repaint/box-shadow-dynamic-expected.txt: Added. 14 * fast/repaint/box-shadow-dynamic.html: Added. 15 * fast/repaint/box-shadow-h-expected.checksum: Added. 16 * fast/repaint/box-shadow-h-expected.png: Added. 17 * fast/repaint/box-shadow-h-expected.txt: Added. 18 * fast/repaint/box-shadow-h.html: Added. 19 * fast/repaint/box-shadow-v-expected.checksum: Added. 20 * fast/repaint/box-shadow-v-expected.png: Added. 21 * fast/repaint/box-shadow-v-expected.txt: Added. 22 * fast/repaint/box-shadow-v.html: Added. 23 1 24 2007-05-20 Mark Rowe <mrowe@apple.com> 2 25 -
trunk/LayoutTests/fast/box-shadow/basic-shadows-expected.checksum
r18654 r21605 1 0ddb70bd830be6c8dc9c767648263ee4 1 da1cb4f18169068cdca839127a165969 -
trunk/LayoutTests/fast/box-shadow/basic-shadows-expected.txt
r19696 r21605 1 layer at (0,0) size 785x6 711 layer at (0,0) size 785x681 2 2 RenderView at (0,0) size 785x600 3 layer at (0,0) size 785x6 713 layer at (0,0) size 785x681 4 4 RenderBlock {HTML} at (0,0) size 785x658 5 5 RenderBody {BODY} at (8,8) size 769x634 -
trunk/WebCore/ChangeLog
r21603 r21605 1 2007-05-19 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Dave Hyatt. 4 5 - fix http://bugs.webkit.org/show_bug.cgi?id=12729 6 box-shadow disappears when scrolling a div that it falls on/under 7 8 Tests: fast/repaint/box-shadow-dynamic.html 9 fast/repaint/box-shadow-h.html 10 fast/repaint/box-shadow-v.html 11 12 * rendering/InlineFlowBox.cpp: 13 (WebCore::InlineFlowBox::placeBoxesHorizontally): Factor in box shadow. 14 (WebCore::InlineFlowBox::placeBoxesVertically): Ditto. 15 (WebCore::InlineFlowBox::paint): Account for box shadow when checking if 16 the damage rect intersects. 17 * rendering/RenderBlock.cpp: 18 (WebCore::RenderBlock::overflowHeight): For overflow areas, when asked 19 for the "exterior" overflow, add box shadow overflow. 20 (WebCore::RenderBlock::overflowWidth): Ditto. 21 (WebCore::RenderBlock::overflowLeft): Ditto. 22 (WebCore::RenderBlock::overflowTop): Ditto. 23 (WebCore::RenderBlock::overflowRect): Ditto. 24 (WebCore::RenderBlock::layoutBlock): Factor box shadow into visual overflow. 25 * rendering/RenderFlexibleBox.cpp: 26 (WebCore::RenderFlexibleBox::layoutBlock): Ditto. 27 * rendering/RenderFlow.cpp: 28 (WebCore::RenderFlow::lowestPosition): For overflow areas, when asked for 29 the "exterior" extreme position, add box shadow. 30 (WebCore::RenderFlow::rightmostPosition): Ditto. 31 (WebCore::RenderFlow::leftmostPosition): Ditto. 32 * rendering/RenderLayer.cpp: 33 (WebCore::RenderLayer::calculateRects): Avoid clipping out box shadow. 34 * rendering/RenderObject.cpp: 35 (WebCore::RenderObject::repaintAfterLayoutIfNeeded): Make sure to paint 36 the box shadow when an edge with a shadow moves. 37 (WebCore::RenderObject::adjustRectForOutlineAndShadow): Helper function 38 that expands a given rectangle to encompass outline and box shadow. 39 (WebCore::RenderObject::absoluteOutlineBox): Changed to include box shadow. 40 * rendering/RenderObject.h: 41 1 42 2007-05-19 Mitz Pettel <mitz@webkit.org> 2 43 -
trunk/WebCore/rendering/InlineFlowBox.cpp
r21397 r21605 247 247 // Set our x position. 248 248 setXPos(x); 249 leftPosition = min(x, leftPosition); 249 250 int boxShadowLeft = 0; 251 int boxShadowRight = 0; 252 if (ShadowData* boxShadow = object()->style(m_firstLine)->boxShadow()) { 253 boxShadowLeft = min(boxShadow->x - boxShadow->blur, 0); 254 boxShadowRight = max(boxShadow->x + boxShadow->blur, 0); 255 } 256 leftPosition = min(x + boxShadowLeft, leftPosition); 250 257 251 258 int startX = x; … … 263 270 text->setXPos(x); 264 271 265 // FIXME: Setting this as layout overflow is bad. We need to have a separate concept of266 // visual overflow.267 272 int strokeOverflow = static_cast<int>(ceilf(rt->style()->textStrokeWidth() / 2.0)); 268 273 … … 317 322 318 323 x += borderRight() + paddingRight(); 319 setWidth(x -startX);320 rightPosition = max(xPos() + width() , rightPosition);324 setWidth(x - startX); 325 rightPosition = max(xPos() + width() + boxShadowRight, rightPosition); 321 326 322 327 return x; … … 478 483 overflowBottom = max(overflowBottom, shadow->y + shadow->blur); 479 484 } 485 486 if (ShadowData* boxShadow = curr->object()->style(m_firstLine)->boxShadow()) { 487 overflowTop = min(overflowTop, boxShadow->y - boxShadow->blur); 488 overflowBottom = max(overflowBottom, boxShadow->y + boxShadow->blur); 489 } 490 480 491 if (curr->isInlineFlowBox()) { 481 492 newHeight += curr->object()->borderTop() + curr->object()->paddingTop() + … … 484 495 newBaseline += curr->object()->borderTop() + curr->object()->paddingTop(); 485 496 } 486 } 487 else if (!curr->object()->isBR()) { 497 } else if (!curr->object()->isBR()) { 488 498 newY += curr->object()->marginTop(); 489 499 newHeight = curr->height() - (curr->object()->marginTop() + curr->object()->marginBottom()); … … 562 572 int xPos = tx + m_x - object()->maximalOutlineSize(paintInfo.phase); 563 573 int w = width() + 2 * object()->maximalOutlineSize(paintInfo.phase); 574 if (ShadowData* boxShadow = object()->style(m_firstLine)->boxShadow()) { 575 int shadowLeft = min(boxShadow->x - boxShadow->blur, 0); 576 xPos += shadowLeft; 577 w += -shadowLeft + max(boxShadow->x + boxShadow->blur, 0); 578 } 564 579 bool intersectsDamageRect = xPos < paintInfo.rect.right() && xPos + w > paintInfo.rect.x(); 565 580 -
trunk/WebCore/rendering/RenderBlock.cpp
r21405 r21605 379 379 int RenderBlock::overflowHeight(bool includeInterior) const 380 380 { 381 return (!includeInterior && hasOverflowClip()) ? m_height : m_overflowHeight; 381 if (!includeInterior && hasOverflowClip()) { 382 if (ShadowData* boxShadow = style()->boxShadow()) 383 return m_height + max(boxShadow->y + boxShadow->blur, 0); 384 return m_height; 385 } 386 return m_overflowHeight; 382 387 } 383 388 384 389 int RenderBlock::overflowWidth(bool includeInterior) const 385 390 { 386 return (!includeInterior && hasOverflowClip()) ? m_width : m_overflowWidth; 387 } 391 if (!includeInterior && hasOverflowClip()) { 392 if (ShadowData* boxShadow = style()->boxShadow()) 393 return m_width + max(boxShadow->x + boxShadow->blur, 0); 394 return m_width; 395 } 396 return m_overflowWidth; 397 } 398 388 399 int RenderBlock::overflowLeft(bool includeInterior) const 389 400 { 390 return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowLeft; 401 if (!includeInterior && hasOverflowClip()) { 402 if (ShadowData* boxShadow = style()->boxShadow()) 403 return min(boxShadow->x - boxShadow->blur, 0); 404 return 0; 405 } 406 return m_overflowLeft; 391 407 } 392 408 393 409 int RenderBlock::overflowTop(bool includeInterior) const 394 410 { 395 return (!includeInterior && hasOverflowClip()) ? 0 : m_overflowTop; 411 if (!includeInterior && hasOverflowClip()) { 412 if (ShadowData* boxShadow = style()->boxShadow()) 413 return min(boxShadow->y - boxShadow->blur, 0); 414 return 0; 415 } 416 return m_overflowTop; 396 417 } 397 418 398 419 IntRect RenderBlock::overflowRect(bool includeInterior) const 399 420 { 421 if (!includeInterior && hasOverflowClip()) { 422 IntRect box = borderBox(); 423 if (ShadowData* boxShadow = style()->boxShadow()) { 424 int shadowLeft = min(boxShadow->x - boxShadow->blur, 0); 425 int shadowRight = max(boxShadow->x + boxShadow->blur, 0); 426 int shadowTop = min(boxShadow->y - boxShadow->blur, 0); 427 int shadowBottom = max(boxShadow->y + boxShadow->blur, 0); 428 box.move(shadowLeft, shadowTop); 429 box.setWidth(box.width() - shadowLeft + shadowRight); 430 box.setHeight(box.height() - shadowTop + shadowBottom); 431 } 432 return box; 433 } 434 400 435 if (!includeInterior && hasOverflowClip()) 401 436 return borderBox(); … … 592 627 m_overflowWidth = max(m_overflowWidth, m_width); 593 628 m_overflowHeight = max(m_overflowHeight, m_height); 629 630 if (!hasOverflowClip()) { 631 if (ShadowData* boxShadow = style()->boxShadow()) { 632 m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur); 633 m_overflowWidth = max(m_overflowWidth, m_width + boxShadow->x + boxShadow->blur); 634 m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur); 635 m_overflowHeight = max(m_overflowHeight, m_height + boxShadow->y + boxShadow->blur); 636 } 637 } 594 638 595 639 if (!hadColumns) -
trunk/WebCore/rendering/RenderFlexibleBox.cpp
r21183 r21605 288 288 if (m_overflowWidth < m_width) 289 289 m_overflowWidth = m_width; 290 291 if (!hasOverflowClip()) { 292 if (ShadowData* boxShadow = style()->boxShadow()) { 293 m_overflowLeft = min(m_overflowLeft, boxShadow->x - boxShadow->blur); 294 m_overflowWidth = max(m_overflowWidth, m_width + boxShadow->x + boxShadow->blur); 295 m_overflowTop = min(m_overflowTop, boxShadow->y - boxShadow->blur); 296 m_overflowHeight = max(m_overflowHeight, m_height + boxShadow->y + boxShadow->blur); 297 } 298 } 290 299 291 300 view()->popLayoutState(); -
trunk/WebCore/rendering/RenderFlow.cpp
r21438 r21605 519 519 { 520 520 ASSERT(!isInlineFlow()); 521 if (!includeOverflowInterior && hasOverflowClip()) 522 return includeSelf && m_width > 0 ? overflowHeight(false) : 0; 523 521 524 int bottom = includeSelf && m_width > 0 ? m_height : 0; 522 if (!includeOverflowInterior && hasOverflowClip())523 return bottom;524 525 525 if (!hasColumns()) { 526 526 // FIXME: Come up with a way to use the layer tree to avoid visiting all the kids. … … 543 543 { 544 544 ASSERT(!isInlineFlow()); 545 if (!includeOverflowInterior && hasOverflowClip()) 546 return includeSelf && m_height > 0 ? overflowWidth(false) : 0; 547 545 548 int right = includeSelf && m_height > 0 ? m_width : 0; 546 if (!includeOverflowInterior && hasOverflowClip())547 return right;548 549 549 if (!hasColumns()) { 550 550 // FIXME: Come up with a way to use the layer tree to avoid visiting all the kids. … … 567 567 { 568 568 ASSERT(!isInlineFlow()); 569 if (!includeOverflowInterior && hasOverflowClip()) 570 return includeSelf && m_height > 0 ? overflowLeft(false) : m_width; 571 569 572 int left = includeSelf && m_height > 0 ? 0 : m_width; 570 if (!includeOverflowInterior && hasOverflowClip())571 return left;572 573 573 if (!hasColumns()) { 574 574 // FIXME: Come up with a way to use the layer tree to avoid visiting all the kids. -
trunk/WebCore/rendering/RenderLayer.cpp
r21390 r21605 1787 1787 // If we establish a clip at all, then go ahead and make sure our background 1788 1788 // rect is intersected with our layer's bounds. 1789 backgroundRect.intersect(layerBounds); 1789 if (ShadowData* boxShadow = renderer()->style()->boxShadow()) { 1790 IntRect shadowRect = layerBounds; 1791 shadowRect.move(boxShadow->x, boxShadow->y); 1792 shadowRect.inflate(boxShadow->blur); 1793 shadowRect.unite(layerBounds); 1794 backgroundRect.intersect(shadowRect); 1795 } else 1796 backgroundRect.intersect(layerBounds); 1790 1797 } 1791 1798 } -
trunk/WebCore/rendering/RenderObject.cpp
r21397 r21605 1831 1831 RenderStyle* outlineStyle = !isInline() && continuation() ? continuation()->style() : style(); 1832 1832 int ow = outlineStyle->outlineSize(); 1833 ShadowData* boxShadow = style()->boxShadow(); 1833 1834 int width = abs(newOutlineBox.width() - oldOutlineBox.width()); 1834 1835 if (width) { 1835 int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight(), max(style()->borderTopRightRadius().width(), style()->borderBottomRightRadius().width()))) + ow; 1836 int shadowRight = boxShadow ? max(boxShadow->x + boxShadow->blur, 0) : 0; 1837 int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight(), max(style()->borderTopRightRadius().width(), style()->borderBottomRightRadius().width()))) + max(ow, shadowRight); 1836 1838 IntRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth, 1837 1839 newOutlineBox.y(), … … 1846 1848 int height = abs(newOutlineBox.height() - oldOutlineBox.height()); 1847 1849 if (height) { 1848 int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom(), max(style()->borderBottomLeftRadius().height(), style()->borderBottomRightRadius().height()))) + ow; 1850 int shadowBottom = boxShadow ? max(boxShadow->y + boxShadow->blur, 0) : 0; 1851 int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom(), max(style()->borderBottomLeftRadius().height(), style()->borderBottomRightRadius().height()))) + max(ow, shadowBottom); 1849 1852 IntRect bottomRect(newOutlineBox.x(), 1850 1853 min(newOutlineBox.bottom(), oldOutlineBox.bottom()) - borderHeight, … … 3034 3037 } 3035 3038 3039 void RenderObject::adjustRectForOutlineAndShadow(IntRect& rect) const 3040 { 3041 int outlineSize = !isInline() && continuation() ? continuation()->style()->outlineSize() : style()->outlineSize(); 3042 if (ShadowData* boxShadow = style()->boxShadow()) { 3043 int shadowLeft = min(boxShadow->x - boxShadow->blur - outlineSize, 0); 3044 int shadowRight = max(boxShadow->x + boxShadow->blur + outlineSize, 0); 3045 int shadowTop = min(boxShadow->y - boxShadow->blur - outlineSize, 0); 3046 int shadowBottom = max(boxShadow->y + boxShadow->blur + outlineSize, 0); 3047 rect.move(shadowLeft, shadowTop); 3048 rect.setWidth(rect.width() - shadowLeft + shadowRight); 3049 rect.setHeight(rect.height() - shadowTop + shadowBottom); 3050 } else 3051 rect.inflate(outlineSize); 3052 } 3053 3036 3054 IntRect RenderObject::absoluteOutlineBox() const 3037 3055 { … … 3041 3059 box.move(x, y); 3042 3060 box.move(view()->layoutDelta()); 3043 if (!isInline() && continuation()) 3044 box.inflate(continuation()->style()->outlineSize()); 3045 else 3046 box.inflate(style()->outlineSize()); 3061 adjustRectForOutlineAndShadow(box); 3047 3062 return box; 3048 3063 } -
trunk/WebCore/rendering/RenderObject.h
r21387 r21605 864 864 virtual void removeLeftoverAnonymousBoxes(); 865 865 866 void adjustRectForOutlineAndShadow(IntRect&) const; 867 866 868 void arenaDelete(RenderArena*, void* objectBase); 867 869
Note: See TracChangeset
for help on using the changeset viewer.