Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rebased.. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectFor Repaint(repaintContainer); 1478 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectFor Repaint(repaintContainer);
1479 LayoutRect newOutlineBox; 1479 LayoutRect newOutlineBox;
1480 1480
1481 bool fullRepaint = selfNeedsLayout(); 1481 bool fullRepaint = selfNeedsLayout();
1482 // Presumably a background or a border exists if border-fit:lines was specif ied. 1482 // Presumably a background or a border exists if border-fit:lines was specif ied.
1483 if (!fullRepaint && style()->borderFit() == BorderFitLines) 1483 if (!fullRepaint && style()->borderFit() == BorderFitLines)
1484 fullRepaint = true; 1484 fullRepaint = true;
1485 if (!fullRepaint && style()->hasBorderRadius()) { 1485 if (!fullRepaint && style()->hasBorderRadius()) {
1486 // If a border-radius exists and width/height is smaller than 1486 // If a border-radius exists and width/height is smaller than
1487 // radius width/height, we cannot use delta-repaint. 1487 // radius width/height, we cannot use delta-repaint.
1488 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds, v); 1488 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds);
1489 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds, v); 1489 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds);
1490 fullRepaint = oldRoundedRect.radii() != newRoundedRect.radii(); 1490 fullRepaint = oldRoundedRect.radii() != newRoundedRect.radii();
1491 } 1491 }
1492 if (!fullRepaint) { 1492 if (!fullRepaint) {
1493 // This ASSERT fails due to animations. See https://bugs.webkit.org/sho w_bug.cgi?id=37048 1493 // This ASSERT fails due to animations. See https://bugs.webkit.org/sho w_bug.cgi?id=37048
1494 // ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBound sForRepaint(repaintContainer)); 1494 // ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBound sForRepaint(repaintContainer));
1495 newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBo undsForRepaint(repaintContainer); 1495 newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBo undsForRepaint(repaintContainer);
1496 if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaint BackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBo x))) 1496 if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaint BackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBo x)))
1497 fullRepaint = true; 1497 fullRepaint = true;
1498 } 1498 }
1499 1499
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 LayoutUnit outlineWidth = outlineStyle->outlineSize(); 1543 LayoutUnit outlineWidth = outlineStyle->outlineSize();
1544 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); 1544 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent();
1545 LayoutUnit width = absoluteValue(newOutlineBox.width() - oldOutlineBox.width ()); 1545 LayoutUnit width = absoluteValue(newOutlineBox.width() - oldOutlineBox.width ());
1546 if (width) { 1546 if (width) {
1547 LayoutUnit shadowLeft; 1547 LayoutUnit shadowLeft;
1548 LayoutUnit shadowRight; 1548 LayoutUnit shadowRight;
1549 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); 1549 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
1550 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1550 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
1551 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit( ); 1551 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit( );
1552 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); 1552 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width()));
1553 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va lueForLength(style()->borderTopRightRadius().width(), boxWidth, v), valueForLeng th(style()->borderBottomRightRadius().width(), boxWidth, v))); 1553 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va lueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength( style()->borderBottomRightRadius().width(), boxWidth)));
1554 LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffs et(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, s hadowRight); 1554 LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffs et(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, s hadowRight);
1555 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldO utlineBox.width()) - decorationsWidth, 1555 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldO utlineBox.width()) - decorationsWidth,
1556 newOutlineBox.y(), 1556 newOutlineBox.y(),
1557 width + decorationsWidth, 1557 width + decorationsWidth,
1558 max(newOutlineBox.height(), oldOutlineBox.height())); 1558 max(newOutlineBox.height(), oldOutlineBox.height()));
1559 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); 1559 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX());
1560 if (rightRect.x() < right) { 1560 if (rightRect.x() < right) {
1561 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); 1561 rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
1562 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRec t)); 1562 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRec t));
1563 } 1563 }
1564 } 1564 }
1565 LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.hei ght()); 1565 LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.hei ght());
1566 if (height) { 1566 if (height) {
1567 LayoutUnit shadowTop; 1567 LayoutUnit shadowTop;
1568 LayoutUnit shadowBottom; 1568 LayoutUnit shadowBottom;
1569 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); 1569 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
1570 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1570 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
1571 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni t(); 1571 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni t();
1572 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height())); 1572 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height()));
1573 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>( valueForLength(style()->borderBottomLeftRadius().height(), boxHeight, v), valueF orLength(style()->borderBottomRightRadius().height(), boxHeight, v))); 1573 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>( valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForL ength(style()->borderBottomRightRadius().height(), boxHeight)));
1574 LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOff set(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth , shadowBottom); 1574 LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOff set(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth , shadowBottom);
1575 LayoutRect bottomRect(newOutlineBox.x(), 1575 LayoutRect bottomRect(newOutlineBox.x(),
1576 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight, 1576 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight,
1577 max(newOutlineBox.width(), oldOutlineBox.width()), 1577 max(newOutlineBox.width(), oldOutlineBox.width()),
1578 height + decorationsHeight); 1578 height + decorationsHeight);
1579 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); 1579 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY());
1580 if (bottomRect.y() < bottom) { 1580 if (bottomRect.y() < bottom) {
1581 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y( ))); 1581 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y( )));
1582 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRe ct)); 1582 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRe ct));
1583 } 1583 }
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 { 3371 {
3372 if (object1) { 3372 if (object1) {
3373 const WebCore::RenderObject* root = object1; 3373 const WebCore::RenderObject* root = object1;
3374 while (root->parent()) 3374 while (root->parent())
3375 root = root->parent(); 3375 root = root->parent();
3376 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3376 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3377 } 3377 }
3378 } 3378 }
3379 3379
3380 #endif 3380 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698