| 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. |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 bool RenderReplaced::needsPreferredWidthsRecalculation() const | 222 bool RenderReplaced::needsPreferredWidthsRecalculation() const |
| 223 { | 223 { |
| 224 // If the height is a percentage and the width is auto, then the containingB
locks's height changing can cause | 224 // If the height is a percentage and the width is auto, then the containingB
locks's height changing can cause |
| 225 // this node to change it's preferred width because it maintains aspect rati
o. | 225 // this node to change it's preferred width because it maintains aspect rati
o. |
| 226 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto() && !ha
sAutoHeightOrContainingBlockWithAutoHeight(); | 226 return hasRelativeLogicalHeight() && style()->logicalWidth().isAuto() && !ha
sAutoHeightOrContainingBlockWithAutoHeight(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 static inline bool rendererHasAspectRatio(const RenderObject* renderer) | 229 static inline bool rendererHasAspectRatio(const RenderObject* renderer) |
| 230 { | 230 { |
| 231 ASSERT(renderer); | 231 ASSERT(renderer); |
| 232 return renderer->isImage() || renderer->isCanvas() || renderer->isVideo(); | 232 return renderer->isImage() || renderer->isCanvas(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 void RenderReplaced::computeAspectRatioInformationForRenderBox(FloatSize& constr
ainedSize, double& intrinsicRatio) const | 235 void RenderReplaced::computeAspectRatioInformationForRenderBox(FloatSize& constr
ainedSize, double& intrinsicRatio) const |
| 236 { | 236 { |
| 237 FloatSize intrinsicSize; | 237 FloatSize intrinsicSize; |
| 238 computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); | 238 computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); |
| 239 if (intrinsicRatio && !intrinsicSize.isEmpty()) | 239 if (intrinsicRatio && !intrinsicSize.isEmpty()) |
| 240 m_intrinsicSize = LayoutSize(intrinsicSize); | 240 m_intrinsicSize = LayoutSize(intrinsicSize); |
| 241 | 241 |
| 242 // Now constrain the intrinsic size along each axis according to minimum and
maximum width/heights along the | 242 // Now constrain the intrinsic size along each axis according to minimum and
maximum width/heights along the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 253 constrainedSize.setHeight(RenderBox::computeReplacedLogicalWidth() * int
rinsicSize.height() / intrinsicSize.width()); | 253 constrainedSize.setHeight(RenderBox::computeReplacedLogicalWidth() * int
rinsicSize.height() / intrinsicSize.width()); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 LayoutRect RenderReplaced::replacedContentRect(const LayoutSize* overriddenIntri
nsicSize) const | 257 LayoutRect RenderReplaced::replacedContentRect(const LayoutSize* overriddenIntri
nsicSize) const |
| 258 { | 258 { |
| 259 LayoutRect contentRect = contentBoxRect(); | 259 LayoutRect contentRect = contentBoxRect(); |
| 260 ObjectFit objectFit = style()->objectFit(); | 260 ObjectFit objectFit = style()->objectFit(); |
| 261 | 261 |
| 262 if (objectFit == ObjectFitFill && style()->objectPosition() == RenderStyle::
initialObjectPosition()) { | 262 if (objectFit == ObjectFitFill && style()->objectPosition() == RenderStyle::
initialObjectPosition()) { |
| 263 if (!isVideo() || RuntimeEnabledFeatures::objectFitPositionEnabled()) | 263 if (RuntimeEnabledFeatures::objectFitPositionEnabled()) |
| 264 return contentRect; | 264 return contentRect; |
| 265 objectFit = ObjectFitContain; | 265 objectFit = ObjectFitContain; |
| 266 } | 266 } |
| 267 | 267 |
| 268 LayoutSize intrinsicSize = overriddenIntrinsicSize ? *overriddenIntrinsicSiz
e : this->intrinsicSize(); | 268 LayoutSize intrinsicSize = overriddenIntrinsicSize ? *overriddenIntrinsicSiz
e : this->intrinsicSize(); |
| 269 if (!intrinsicSize.width() || !intrinsicSize.height()) | 269 if (!intrinsicSize.width() || !intrinsicSize.height()) |
| 270 return contentRect; | 270 return contentRect; |
| 271 | 271 |
| 272 LayoutRect finalRect = contentRect; | 272 LayoutRect finalRect = contentRect; |
| 273 switch (objectFit) { | 273 switch (objectFit) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const | 534 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const |
| 535 { | 535 { |
| 536 // The selectionRect can project outside of the overflowRect, so take their
union | 536 // The selectionRect can project outside of the overflowRect, so take their
union |
| 537 // for paint invalidation to avoid selection painting glitches. | 537 // for paint invalidation to avoid selection painting glitches. |
| 538 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 538 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
| 539 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 539 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
| 540 return r; | 540 return r; |
| 541 } | 541 } |
| 542 | 542 |
| 543 } | 543 } |
| OLD | NEW |