Chromium Code Reviews| 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 // If the image has neither an intrinsic width nor an intrinsic heig ht, its size is determined as for ‘contain’. | 927 // If the image has neither an intrinsic width nor an intrinsic heig ht, its size is determined as for ‘contain’. |
| 928 type = Contain; | 928 type = Contain; |
| 929 } | 929 } |
| 930 case Contain: | 930 case Contain: |
| 931 case Cover: { | 931 case Cover: { |
| 932 float horizontalScaleFactor = imageIntrinsicSize.width() | 932 float horizontalScaleFactor = imageIntrinsicSize.width() |
| 933 ? static_cast<float>(positioningAreaSize.width()) / imageIntrins icSize.width() : 1; | 933 ? static_cast<float>(positioningAreaSize.width()) / imageIntrins icSize.width() : 1; |
| 934 float verticalScaleFactor = imageIntrinsicSize.height() | 934 float verticalScaleFactor = imageIntrinsicSize.height() |
| 935 ? static_cast<float>(positioningAreaSize.height()) / imageIntrin sicSize.height() : 1; | 935 ? static_cast<float>(positioningAreaSize.height()) / imageIntrin sicSize.height() : 1; |
| 936 float scaleFactor = type == Contain ? min(horizontalScaleFactor, ver ticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor); | 936 float scaleFactor = type == Contain ? min(horizontalScaleFactor, ver ticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor); |
| 937 return IntSize(max(1, static_cast<int>(imageIntrinsicSize.width() * scaleFactor)), max(1, static_cast<int>(imageIntrinsicSize.height() * scaleFactor ))); | 937 return IntSize(max(1, static_cast<int>(round(imageIntrinsicSize.widt h() * scaleFactor))), max(1, static_cast<int>(round(imageIntrinsicSize.height() * scaleFactor)))); |
|
eseidel
2013/09/18 18:59:45
should this just be lround?
| |
| 938 } | 938 } |
| 939 } | 939 } |
| 940 | 940 |
| 941 ASSERT_NOT_REACHED(); | 941 ASSERT_NOT_REACHED(); |
| 942 return IntSize(); | 942 return IntSize(); |
| 943 } | 943 } |
| 944 | 944 |
| 945 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset) | 945 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset) |
| 946 { | 946 { |
| 947 m_destRect.move(max(xOffset, 0), 0); | 947 m_destRect.move(max(xOffset, 0), 0); |
| (...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 2787 for (RenderObject* child = startChild; child && child != endChild; ) { | 2787 for (RenderObject* child = startChild; child && child != endChild; ) { |
| 2788 // Save our next sibling as moveChildTo will clear it. | 2788 // Save our next sibling as moveChildTo will clear it. |
| 2789 RenderObject* nextSibling = child->nextSibling(); | 2789 RenderObject* nextSibling = child->nextSibling(); |
| 2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 2791 child = nextSibling; | 2791 child = nextSibling; |
| 2792 } | 2792 } |
| 2793 } | 2793 } |
| 2794 | 2794 |
| 2795 } // namespace WebCore | 2795 } // namespace WebCore |
| OLD | NEW |