| OLD | NEW |
| 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 { | 798 { |
| 799 // A generated image without a fixed size, will always return the container
size as intrinsic size. | 799 // A generated image without a fixed size, will always return the container
size as intrinsic size. |
| 800 if (image->isGeneratedImage() && image->usesImageContainerSize()) | 800 if (image->isGeneratedImage() && image->usesImageContainerSize()) |
| 801 return IntSize(positioningAreaSize.width(), positioningAreaSize.height()
); | 801 return IntSize(positioningAreaSize.width(), positioningAreaSize.height()
); |
| 802 | 802 |
| 803 Length intrinsicWidth; | 803 Length intrinsicWidth; |
| 804 Length intrinsicHeight; | 804 Length intrinsicHeight; |
| 805 FloatSize intrinsicRatio; | 805 FloatSize intrinsicRatio; |
| 806 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int
rinsicRatio); | 806 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int
rinsicRatio); |
| 807 | 807 |
| 808 // Intrinsic dimensions expressed as percentages must be resolved relative t
o the dimensions of the rectangle | 808 ASSERT(!intrinsicWidth.isPercent()); |
| 809 // that establishes the coordinate system for the 'background-position' prop
erty. | 809 ASSERT(!intrinsicHeight.isPercent()); |
| 810 | 810 |
| 811 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/
63656 | 811 IntSize resolvedSize(intrinsicWidth.value(), intrinsicHeight.value()); |
| 812 if (intrinsicWidth.isPercent() && intrinsicHeight.isPercent() && intrinsicRa
tio.isEmpty()) { | |
| 813 // Resolve width/height percentages against positioningAreaSize, only if
no intrinsic ratio is provided. | |
| 814 int resolvedWidth = static_cast<int>(round(positioningAreaSize.width() *
intrinsicWidth.percent() / 100)); | |
| 815 int resolvedHeight = static_cast<int>(round(positioningAreaSize.height()
* intrinsicHeight.percent() / 100)); | |
| 816 return IntSize(resolvedWidth, resolvedHeight); | |
| 817 } | |
| 818 | |
| 819 IntSize resolvedSize(intrinsicWidth.isFixed() ? intrinsicWidth.value() : 0,
intrinsicHeight.isFixed() ? intrinsicHeight.value() : 0); | |
| 820 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height()
> 0 ? 1 : 0); | 812 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height()
> 0 ? 1 : 0); |
| 821 if (shouldScaleOrNot == ScaleByEffectiveZoom) | 813 if (shouldScaleOrNot == ScaleByEffectiveZoom) |
| 822 resolvedSize.scale(style()->effectiveZoom()); | 814 resolvedSize.scale(style()->effectiveZoom()); |
| 823 resolvedSize.clampToMinimumSize(minimumSize); | 815 resolvedSize.clampToMinimumSize(minimumSize); |
| 824 | 816 |
| 825 if (!resolvedSize.isEmpty()) | 817 if (!resolvedSize.isEmpty()) |
| 826 return resolvedSize; | 818 return resolvedSize; |
| 827 | 819 |
| 828 // If the image has one of either an intrinsic width or an intrinsic height: | 820 // If the image has one of either an intrinsic width or an intrinsic height: |
| 829 // * and an intrinsic aspect ratio, then the missing dimension is calculated
from the given dimension and the ratio. | 821 // * and an intrinsic aspect ratio, then the missing dimension is calculated
from the given dimension and the ratio. |
| (...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2824 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2816 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2825 for (RenderObject* child = startChild; child && child != endChild; ) { | 2817 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2826 // Save our next sibling as moveChildTo will clear it. | 2818 // Save our next sibling as moveChildTo will clear it. |
| 2827 RenderObject* nextSibling = child->nextSibling(); | 2819 RenderObject* nextSibling = child->nextSibling(); |
| 2828 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2820 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2829 child = nextSibling; | 2821 child = nextSibling; |
| 2830 } | 2822 } |
| 2831 } | 2823 } |
| 2832 | 2824 |
| 2833 } // namespace WebCore | 2825 } // namespace WebCore |
| OLD | NEW |