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

Side by Side Diff: Source/core/layout/LayoutBoxModelObject.cpp

Issue 1096993003: Tighten assertions around StyleImage::computeIntrinsicDimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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) 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 ASSERT(solutionHeight <= size.height()); 608 ASSERT(solutionHeight <= size.height());
609 return IntSize(size.width(), solutionHeight); 609 return IntSize(size.width(), solutionHeight);
610 } 610 }
611 611
612 IntSize LayoutBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* imag e, const IntSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNo t) const 612 IntSize LayoutBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* imag e, const IntSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNo t) const
613 { 613 {
614 // A generated image without a fixed size, will always return the container size as intrinsic size. 614 // A generated image without a fixed size, will always return the container size as intrinsic size.
615 if (image->isGeneratedImage() && image->usesImageContainerSize()) 615 if (image->isGeneratedImage() && image->usesImageContainerSize())
616 return IntSize(positioningAreaSize.width(), positioningAreaSize.height() ); 616 return IntSize(positioningAreaSize.width(), positioningAreaSize.height() );
617 617
618 Length intrinsicWidth; 618 Length intrinsicWidth(Fixed);
619 Length intrinsicHeight; 619 Length intrinsicHeight(Fixed);
620 FloatSize intrinsicRatio; 620 FloatSize intrinsicRatio;
621 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int rinsicRatio); 621 image->computeIntrinsicDimensions(this, intrinsicWidth, intrinsicHeight, int rinsicRatio);
622 622
623 ASSERT(!intrinsicWidth.isPercent()); 623 ASSERT(intrinsicWidth.isFixed());
624 ASSERT(!intrinsicHeight.isPercent()); 624 ASSERT(intrinsicHeight.isFixed());
625 625
626 IntSize resolvedSize(intrinsicWidth.value(), intrinsicHeight.value()); 626 IntSize resolvedSize(intrinsicWidth.value(), intrinsicHeight.value());
627 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0); 627 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);
628 if (shouldScaleOrNot == ScaleByEffectiveZoom) 628 if (shouldScaleOrNot == ScaleByEffectiveZoom)
629 resolvedSize.scale(style()->effectiveZoom()); 629 resolvedSize.scale(style()->effectiveZoom());
630 resolvedSize.clampToMinimumSize(minimumSize); 630 resolvedSize.clampToMinimumSize(minimumSize);
631 631
632 if (!resolvedSize.isEmpty()) 632 if (!resolvedSize.isEmpty())
633 return resolvedSize; 633 return resolvedSize;
634 634
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 913 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
914 for (LayoutObject* child = startChild; child && child != endChild; ) { 914 for (LayoutObject* child = startChild; child && child != endChild; ) {
915 // Save our next sibling as moveChildTo will clear it. 915 // Save our next sibling as moveChildTo will clear it.
916 LayoutObject* nextSibling = child->nextSibling(); 916 LayoutObject* nextSibling = child->nextSibling();
917 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 917 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
918 child = nextSibling; 918 child = nextSibling;
919 } 919 }
920 } 920 }
921 921
922 } // namespace blink 922 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698