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

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

Issue 26390004: Rework SVG sizing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix mishap during rebase in svg.css Created 6 years, 8 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
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) 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 while (cb->isAnonymous()) 180 while (cb->isAnonymous())
181 cb = cb->containingBlock(); 181 cb = cb->containingBlock();
182 182
183 // Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by 183 // Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by
184 // ignoring table cell's attribute value, where it says that table cells vio late 184 // ignoring table cell's attribute value, where it says that table cells vio late
185 // what the CSS spec says to do with heights. Basically we 185 // what the CSS spec says to do with heights. Basically we
186 // don't care if the cell specified a height or not. 186 // don't care if the cell specified a height or not.
187 if (cb->isTableCell()) 187 if (cb->isTableCell())
188 return false; 188 return false;
189 189
190 // Match RenderBox::availableLogicalHeightUsing by special casing
191 // the render view. The available height is taken from the frame.
192 if (cb->isRenderView())
193 return false;
194
190 if (!cb->style()->logicalHeight().isAuto() || (!cb->style()->logicalTop().is Auto() && !cb->style()->logicalBottom().isAuto())) 195 if (!cb->style()->logicalHeight().isAuto() || (!cb->style()->logicalTop().is Auto() && !cb->style()->logicalBottom().isAuto()))
191 return false; 196 return false;
192 197
193 return true; 198 return true;
194 } 199 }
195 200
196 LayoutSize RenderBoxModelObject::relativePositionOffset() const 201 LayoutSize RenderBoxModelObject::relativePositionOffset() const
197 { 202 {
198 LayoutSize offset = accumulateInFlowPositionOffsets(this); 203 LayoutSize offset = accumulateInFlowPositionOffsets(this);
199 204
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 { 803 {
799 // A generated image without a fixed size, will always return the container size as intrinsic size. 804 // A generated image without a fixed size, will always return the container size as intrinsic size.
800 if (image->isGeneratedImage() && image->usesImageContainerSize()) 805 if (image->isGeneratedImage() && image->usesImageContainerSize())
801 return IntSize(positioningAreaSize.width(), positioningAreaSize.height() ); 806 return IntSize(positioningAreaSize.width(), positioningAreaSize.height() );
802 807
803 Length intrinsicWidth; 808 Length intrinsicWidth;
804 Length intrinsicHeight; 809 Length intrinsicHeight;
805 FloatSize intrinsicRatio; 810 FloatSize intrinsicRatio;
806 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int rinsicRatio); 811 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int rinsicRatio);
807 812
808 // Intrinsic dimensions expressed as percentages must be resolved relative t o the dimensions of the rectangle 813 ASSERT(!intrinsicWidth.isPercent());
809 // that establishes the coordinate system for the 'background-position' prop erty. 814 ASSERT(!intrinsicHeight.isPercent());
810 815
811 // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/ 63656 816 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); 817 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);
821 if (shouldScaleOrNot == ScaleByEffectiveZoom) 818 if (shouldScaleOrNot == ScaleByEffectiveZoom)
822 resolvedSize.scale(style()->effectiveZoom()); 819 resolvedSize.scale(style()->effectiveZoom());
823 resolvedSize.clampToMinimumSize(minimumSize); 820 resolvedSize.clampToMinimumSize(minimumSize);
824 821
825 if (!resolvedSize.isEmpty()) 822 if (!resolvedSize.isEmpty())
826 return resolvedSize; 823 return resolvedSize;
827 824
828 // If the image has one of either an intrinsic width or an intrinsic height: 825 // 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. 826 // * 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
2824 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2821 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2825 for (RenderObject* child = startChild; child && child != endChild; ) { 2822 for (RenderObject* child = startChild; child && child != endChild; ) {
2826 // Save our next sibling as moveChildTo will clear it. 2823 // Save our next sibling as moveChildTo will clear it.
2827 RenderObject* nextSibling = child->nextSibling(); 2824 RenderObject* nextSibling = child->nextSibling();
2828 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2825 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2829 child = nextSibling; 2826 child = nextSibling;
2830 } 2827 }
2831 } 2828 }
2832 2829
2833 } // namespace WebCore 2830 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698