Changeset 26894 in webkit
- Timestamp:
- Oct 22, 2007 2:29:37 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r26889 r26894 1 2007-10-22 David Hyatt <hyatt@apple.com> 2 3 Fix for bug 15624, make transforms work properly with opacity. 4 5 Make sure a unitless 0 is allowed as an angle argument to rotation/skew. 6 7 Reviewed by Mitz Pettel 8 9 fast/transforms/transforms-with-opacity.html 10 fast/transforms/skew-with-unitless-zero.html 11 12 * css/CSSParser.cpp: 13 (WebCore::CSSParser::validUnit): 14 * rendering/RenderLayer.cpp: 15 (WebCore::transparencyClipBox): 16 (WebCore::RenderLayer::beginTransparencyLayers): 17 (WebCore::RenderLayer::paintLayer): 18 (WebCore::RenderLayer::calculateClipRects): 19 * rendering/RenderLayer.h: 20 (WebCore::RenderLayer::transform): 21 1 22 2007-10-22 Adam Roben <aroben@apple.com> 2 23 -
trunk/WebCore/css/CSSParser.cpp
r26843 r26894 388 388 case CSSPrimitiveValue::CSS_NUMBER: 389 389 b = (unitflags & FNumber); 390 if (!b && ((unitflags & FLength) && (value->fValue == 0 || !strict))) {391 value->unit = CSSPrimitiveValue::CSS_PX;390 if (!b && ((unitflags & (FLength | FAngle)) && (value->fValue == 0 || !strict))) { 391 value->unit = (unitflags & FLength) ? CSSPrimitiveValue::CSS_PX : CSSPrimitiveValue::CSS_DEG; 392 392 b = true; 393 393 } -
trunk/WebCore/rendering/RenderLayer.cpp
r26865 r26894 437 437 } 438 438 439 static IntRect transparencyClipBox(const RenderLayer* l, const RenderLayer* rootLayer) 440 { 441 // FIXME: This function does not work properly with transforms. 442 443 // FIXME: Although this completely ignores clipping, we ultimately intersect with the 439 static IntRect transparencyClipBox(const AffineTransform& enclosingTransform, const RenderLayer* l, const RenderLayer* rootLayer) 440 { 441 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the 444 442 // paintDirtyRect, and that should cut down on the amount we have to paint. Still it 445 443 // would be better to respect clips. 444 445 AffineTransform* t = l->transform(); 446 if (t) { 447 // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass 448 // the transformed layer and all of its children. 449 int x = 0; 450 int y = 0; 451 l->convertToLayerCoords(rootLayer, x, y); 452 AffineTransform transform; 453 transform.translate(x, y); 454 transform = *t * transform; 455 transform = transform * enclosingTransform; 456 457 // We now have a transform that will produce a rectangle in our view's space. 458 IntRect clipRect = transform.mapRect(l->boundingBox(l)); 459 460 // Now shift the root layer to be us and pass down the new enclosing transform. 461 for (RenderLayer* curr = l->firstChild(); curr; curr = curr->nextSibling()) 462 clipRect.unite(transparencyClipBox(transform, curr, l)); 463 464 return clipRect; 465 } 466 467 // Note: we don't have to walk z-order lists since transparent elements always establish 468 // a stacking context. This means we can just walk the layer tree directly. 446 469 IntRect clipRect = l->boundingBox(rootLayer); 447 448 // Note: we don't have to walk z-order lists since transparent elements always establish449 // a stacking context. This means we can just walk the layer tree directly.450 470 for (RenderLayer* curr = l->firstChild(); curr; curr = curr->nextSibling()) 451 clipRect.unite(transparencyClipBox( curr, rootLayer));471 clipRect.unite(transparencyClipBox(enclosingTransform, curr, rootLayer)); 452 472 453 473 return clipRect; 454 474 } 455 475 456 void RenderLayer::beginTransparencyLayers(GraphicsContext* p, const IntRect& paintDirtyRect, constRenderLayer* rootLayer)476 void RenderLayer::beginTransparencyLayers(GraphicsContext* p, const RenderLayer* rootLayer) 457 477 { 458 478 if (p->paintingDisabled() || (isTransparent() && m_usedTransparency)) … … 461 481 RenderLayer* ancestor = transparentAncestor(); 462 482 if (ancestor) 463 ancestor->beginTransparencyLayers(p, paintDirtyRect,rootLayer);483 ancestor->beginTransparencyLayers(p, rootLayer); 464 484 465 485 if (isTransparent()) { 466 486 m_usedTransparency = true; 467 IntRect clipRect = transparencyClipBox(this, rootLayer);468 clipRect.intersect(paintDirtyRect);469 487 p->save(); 470 p->clip( clipRect);488 p->clip(transparencyClipBox(AffineTransform(), this, rootLayer)); 471 489 p->beginTransparencyLayer(renderer()->opacity()); 472 490 } … … 1445 1463 return; 1446 1464 1465 // If this layer is totally invisible then there is nothing to paint. 1466 if (!m_object->opacity()) 1467 return; 1468 1469 if (isTransparent()) 1470 haveTransparency = true; 1471 1447 1472 // Apply a transform if we have one. 1448 1473 if (m_transform && rootLayer != this) { … … 1451 1476 return; 1452 1477 1478 // If we have a transparency layer enclosing us and we are the root of a transform, then we need to establish the transparency 1479 // layer from the parent now. 1480 if (haveTransparency) 1481 parent()->beginTransparencyLayers(p, rootLayer); 1482 1453 1483 // Make sure the parent's clip rects have been calculated. 1454 1484 parent()->calculateClipRects(rootLayer); … … 1471 1501 p->save(); 1472 1502 p->concatCTM(transform); 1473 1503 1474 1504 // Now do a paint with the root layer shifted to be us. 1475 // FIXME: We aren't handling transparency correctly yet. We need to aggressively begin the transparency layer1476 // now so that the clip box will be computed properly.1477 1505 rootLayer = this; 1478 1506 paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), haveTransparency, paintRestriction, paintingRoot); … … 1498 1526 updateOverflowList(); 1499 1527 1500 // If this layer is totally invisible then there is nothing to paint.1501 if (!m_object->opacity())1502 return;1503 1504 1528 bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText; 1505 1529 bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText; 1506 1507 if (isTransparent())1508 haveTransparency = true;1509 1530 1510 1531 // If this layer's renderer is a child of the paintingRoot, we render unconditionally, which … … 1515 1536 if (paintingRoot && !m_object->isDescendantOf(paintingRoot)) 1516 1537 paintingRootForRenderer = paintingRoot; 1517 1538 1518 1539 // We want to paint our layer, but only if we intersect the damage rect. 1519 1540 bool shouldPaint = intersectsDamageRect(layerBounds, damageRect, rootLayer) && m_hasVisibleContent; … … 1521 1542 // Begin transparency layers lazily now that we know we have to paint something. 1522 1543 if (haveTransparency) 1523 beginTransparencyLayers(p, paintDirtyRect,rootLayer);1544 beginTransparencyLayers(p, rootLayer); 1524 1545 1525 1546 // Paint our background first, before painting any child layers. … … 1549 1570 // Begin transparency layers lazily now that we know we have to paint something. 1550 1571 if (haveTransparency) 1551 beginTransparencyLayers(p, paintDirtyRect,rootLayer);1572 beginTransparencyLayers(p, rootLayer); 1552 1573 1553 1574 // Set up the clip used when painting our children. … … 1743 1764 1744 1765 if (rootLayer == this || !parent()) { 1745 // The root layer's clip rect is always just its dimensions.1746 m_clipRects = new (m_object->renderArena()) ClipRects(IntRect( 0,0,width(),height()));1766 // The root layer's clip rect is always infinite. 1767 m_clipRects = new (m_object->renderArena()) ClipRects(IntRect(INT_MIN/2, INT_MIN/2, INT_MAX, INT_MAX)); 1747 1768 m_clipRects->ref(); 1748 1769 return; -
trunk/WebCore/rendering/RenderLayer.h
r26843 r26894 212 212 bool isTransparent() const; 213 213 RenderLayer* transparentAncestor(); 214 void beginTransparencyLayers(GraphicsContext*, const IntRect&, constRenderLayer* rootLayer);214 void beginTransparencyLayers(GraphicsContext*, const RenderLayer* rootLayer); 215 215 216 216 const RenderLayer* root() const … … 350 350 void setStaticY(int staticY) { m_staticY = staticY; } 351 351 352 AffineTransform* transform() const { return m_transform.get(); } 353 352 354 void destroy(RenderArena*); 353 355
Note: See TracChangeset
for help on using the changeset viewer.