| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/rendering/RenderReplaced.h" | 25 #include "core/rendering/RenderReplaced.h" |
| 26 | 26 |
| 27 #include "core/editing/PositionWithAffinity.h" | 27 #include "core/editing/PositionWithAffinity.h" |
| 28 #include "core/layout/Layer.h" | 28 #include "core/layout/Layer.h" |
| 29 #include "core/layout/LayoutImage.h" |
| 29 #include "core/paint/ReplacedPainter.h" | 30 #include "core/paint/ReplacedPainter.h" |
| 30 #include "core/rendering/RenderBlock.h" | 31 #include "core/rendering/RenderBlock.h" |
| 31 #include "core/rendering/RenderImage.h" | |
| 32 #include "core/rendering/RenderView.h" | 32 #include "core/rendering/RenderView.h" |
| 33 #include "platform/LengthFunctions.h" | 33 #include "platform/LengthFunctions.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 const int RenderReplaced::defaultWidth = 300; | 37 const int RenderReplaced::defaultWidth = 300; |
| 38 const int RenderReplaced::defaultHeight = 150; | 38 const int RenderReplaced::defaultHeight = 150; |
| 39 | 39 |
| 40 RenderReplaced::RenderReplaced(Element* element) | 40 RenderReplaced::RenderReplaced(Element* element) |
| 41 : RenderBox(element) | 41 : RenderBox(element) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten
tRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const | 175 void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten
tRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const |
| 176 { | 176 { |
| 177 FloatSize intrinsicSize; | 177 FloatSize intrinsicSize; |
| 178 if (contentRenderer) { | 178 if (contentRenderer) { |
| 179 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrins
icRatio); | 179 contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrins
icRatio); |
| 180 | 180 |
| 181 // Handle zoom & vertical writing modes here, as the embedded document d
oesn't know about them. | 181 // Handle zoom & vertical writing modes here, as the embedded document d
oesn't know about them. |
| 182 intrinsicSize.scale(style()->effectiveZoom()); | 182 intrinsicSize.scale(style()->effectiveZoom()); |
| 183 if (isRenderImage()) | 183 if (isLayoutImage()) |
| 184 intrinsicSize.scale(toRenderImage(this)->imageDevicePixelRatio()); | 184 intrinsicSize.scale(toLayoutImage(this)->imageDevicePixelRatio()); |
| 185 | 185 |
| 186 // Update our intrinsic size to match what the content renderer has comp
uted, so that when we | 186 // Update our intrinsic size to match what the content renderer has comp
uted, so that when we |
| 187 // constrain the size below, the correct intrinsic size will be obtained
for comparison against | 187 // constrain the size below, the correct intrinsic size will be obtained
for comparison against |
| 188 // min and max widths. | 188 // min and max widths. |
| 189 if (intrinsicRatio && !intrinsicSize.isEmpty()) | 189 if (intrinsicRatio && !intrinsicSize.isEmpty()) |
| 190 m_intrinsicSize = LayoutSize(intrinsicSize); | 190 m_intrinsicSize = LayoutSize(intrinsicSize); |
| 191 | 191 |
| 192 if (!isHorizontalWritingMode()) { | 192 if (!isHorizontalWritingMode()) { |
| 193 if (intrinsicRatio) | 193 if (intrinsicRatio) |
| 194 intrinsicRatio = 1 / intrinsicRatio; | 194 intrinsicRatio = 1 / intrinsicRatio; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 return LayoutRect(); | 502 return LayoutRect(); |
| 503 | 503 |
| 504 // The selectionRect can project outside of the overflowRect, so take their
union | 504 // The selectionRect can project outside of the overflowRect, so take their
union |
| 505 // for paint invalidation to avoid selection painting glitches. | 505 // for paint invalidation to avoid selection painting glitches. |
| 506 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 506 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
| 507 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 507 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
| 508 return r; | 508 return r; |
| 509 } | 509 } |
| 510 | 510 |
| 511 } | 511 } |
| OLD | NEW |