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

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: rename browser zoom to page zoom Created 6 years, 11 months 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
« no previous file with comments | « Source/core/rendering/RenderMenuList.cpp ('k') | Source/core/rendering/RenderReplaced.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectFor Repaint(repaintContainer); 1494 LayoutRect newBounds = newBoundsPtr ? *newBoundsPtr : clippedOverflowRectFor Repaint(repaintContainer);
1495 LayoutRect newOutlineBox; 1495 LayoutRect newOutlineBox;
1496 1496
1497 bool fullRepaint = wasSelfLayout; 1497 bool fullRepaint = wasSelfLayout;
1498 // Presumably a background or a border exists if border-fit:lines was specif ied. 1498 // Presumably a background or a border exists if border-fit:lines was specif ied.
1499 if (!fullRepaint && style()->borderFit() == BorderFitLines) 1499 if (!fullRepaint && style()->borderFit() == BorderFitLines)
1500 fullRepaint = true; 1500 fullRepaint = true;
1501 if (!fullRepaint && style()->hasBorderRadius()) { 1501 if (!fullRepaint && style()->hasBorderRadius()) {
1502 // If a border-radius exists and width/height is smaller than 1502 // If a border-radius exists and width/height is smaller than
1503 // radius width/height, we cannot use delta-repaint. 1503 // radius width/height, we cannot use delta-repaint.
1504 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds, v); 1504 RoundedRect oldRoundedRect = style()->getRoundedBorderFor(oldBounds);
1505 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds, v); 1505 RoundedRect newRoundedRect = style()->getRoundedBorderFor(newBounds);
1506 fullRepaint = oldRoundedRect.radii() != newRoundedRect.radii(); 1506 fullRepaint = oldRoundedRect.radii() != newRoundedRect.radii();
1507 } 1507 }
1508 if (!fullRepaint) { 1508 if (!fullRepaint) {
1509 // This ASSERT fails due to animations. See https://bugs.webkit.org/sho w_bug.cgi?id=37048 1509 // This ASSERT fails due to animations. See https://bugs.webkit.org/sho w_bug.cgi?id=37048
1510 // ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBound sForRepaint(repaintContainer)); 1510 // ASSERT(!newOutlineBoxRectPtr || *newOutlineBoxRectPtr == outlineBound sForRepaint(repaintContainer));
1511 newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBo undsForRepaint(repaintContainer); 1511 newOutlineBox = newOutlineBoxRectPtr ? *newOutlineBoxRectPtr : outlineBo undsForRepaint(repaintContainer);
1512 if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaint BackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBo x))) 1512 if (newOutlineBox.location() != oldOutlineBox.location() || (mustRepaint BackgroundOrBorder() && (newBounds != oldBounds || newOutlineBox != oldOutlineBo x)))
1513 fullRepaint = true; 1513 fullRepaint = true;
1514 } 1514 }
1515 1515
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 LayoutUnit outlineWidth = outlineStyle->outlineSize(); 1559 LayoutUnit outlineWidth = outlineStyle->outlineSize();
1560 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent(); 1560 LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent();
1561 LayoutUnit width = absoluteValue(newOutlineBox.width() - oldOutlineBox.width ()); 1561 LayoutUnit width = absoluteValue(newOutlineBox.width() - oldOutlineBox.width ());
1562 if (width) { 1562 if (width) {
1563 LayoutUnit shadowLeft; 1563 LayoutUnit shadowLeft;
1564 LayoutUnit shadowRight; 1564 LayoutUnit shadowRight;
1565 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight); 1565 style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
1566 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0; 1566 int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
1567 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit( ); 1567 LayoutUnit boxWidth = isBox() ? toRenderBox(this)->width() : LayoutUnit( );
1568 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width())); 1568 LayoutUnit minInsetRightShadowExtent = min<LayoutUnit>(-insetShadowExten t.right(), min<LayoutUnit>(newBounds.width(), oldBounds.width()));
1569 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va lueForLength(style()->borderTopRightRadius().width(), boxWidth, v), valueForLeng th(style()->borderBottomRightRadius().width(), boxWidth, v))); 1569 LayoutUnit borderWidth = max<LayoutUnit>(borderRight, max<LayoutUnit>(va lueForLength(style()->borderTopRightRadius().width(), boxWidth), valueForLength( style()->borderBottomRightRadius().width(), boxWidth)));
1570 LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffs et(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, s hadowRight); 1570 LayoutUnit decorationsWidth = max<LayoutUnit>(-outlineStyle->outlineOffs et(), borderWidth + minInsetRightShadowExtent) + max<LayoutUnit>(outlineWidth, s hadowRight);
1571 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldO utlineBox.width()) - decorationsWidth, 1571 LayoutRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldO utlineBox.width()) - decorationsWidth,
1572 newOutlineBox.y(), 1572 newOutlineBox.y(),
1573 width + decorationsWidth, 1573 width + decorationsWidth,
1574 max(newOutlineBox.height(), oldOutlineBox.height())); 1574 max(newOutlineBox.height(), oldOutlineBox.height()));
1575 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX()); 1575 LayoutUnit right = min<LayoutUnit>(newBounds.maxX(), oldBounds.maxX());
1576 if (rightRect.x() < right) { 1576 if (rightRect.x() < right) {
1577 rightRect.setWidth(min(rightRect.width(), right - rightRect.x())); 1577 rightRect.setWidth(min(rightRect.width(), right - rightRect.x()));
1578 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRec t)); 1578 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(rightRec t));
1579 } 1579 }
1580 } 1580 }
1581 LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.hei ght()); 1581 LayoutUnit height = absoluteValue(newOutlineBox.height() - oldOutlineBox.hei ght());
1582 if (height) { 1582 if (height) {
1583 LayoutUnit shadowTop; 1583 LayoutUnit shadowTop;
1584 LayoutUnit shadowBottom; 1584 LayoutUnit shadowBottom;
1585 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom); 1585 style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
1586 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0; 1586 int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
1587 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni t(); 1587 LayoutUnit boxHeight = isBox() ? toRenderBox(this)->height() : LayoutUni t();
1588 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height())); 1588 LayoutUnit minInsetBottomShadowExtent = min<LayoutUnit>(-insetShadowExte nt.bottom(), min<LayoutUnit>(newBounds.height(), oldBounds.height()));
1589 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>( valueForLength(style()->borderBottomLeftRadius().height(), boxHeight, v), valueF orLength(style()->borderBottomRightRadius().height(), boxHeight, v))); 1589 LayoutUnit borderHeight = max<LayoutUnit>(borderBottom, max<LayoutUnit>( valueForLength(style()->borderBottomLeftRadius().height(), boxHeight), valueForL ength(style()->borderBottomRightRadius().height(), boxHeight)));
1590 LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOff set(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth , shadowBottom); 1590 LayoutUnit decorationsHeight = max<LayoutUnit>(-outlineStyle->outlineOff set(), borderHeight + minInsetBottomShadowExtent) + max<LayoutUnit>(outlineWidth , shadowBottom);
1591 LayoutRect bottomRect(newOutlineBox.x(), 1591 LayoutRect bottomRect(newOutlineBox.x(),
1592 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight, 1592 min(newOutlineBox.maxY(), oldOutlineBox.maxY()) - decorationsHeight,
1593 max(newOutlineBox.width(), oldOutlineBox.width()), 1593 max(newOutlineBox.width(), oldOutlineBox.width()),
1594 height + decorationsHeight); 1594 height + decorationsHeight);
1595 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY()); 1595 LayoutUnit bottom = min(newBounds.maxY(), oldBounds.maxY());
1596 if (bottomRect.y() < bottom) { 1596 if (bottomRect.y() < bottom) {
1597 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y( ))); 1597 bottomRect.setHeight(min(bottomRect.height(), bottom - bottomRect.y( )));
1598 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRe ct)); 1598 repaintUsingContainer(repaintContainer, pixelSnappedIntRect(bottomRe ct));
1599 } 1599 }
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 { 3400 {
3401 if (object1) { 3401 if (object1) {
3402 const WebCore::RenderObject* root = object1; 3402 const WebCore::RenderObject* root = object1;
3403 while (root->parent()) 3403 while (root->parent())
3404 root = root->parent(); 3404 root = root->parent();
3405 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3405 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3406 } 3406 }
3407 } 3407 }
3408 3408
3409 #endif 3409 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderMenuList.cpp ('k') | Source/core/rendering/RenderReplaced.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698