| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 { | 230 { |
| 231 ASSERT(renderer); | 231 ASSERT(renderer); |
| 232 return renderer->isImage() || renderer->isCanvas() || renderer->isVideo(); | 232 return renderer->isImage() || renderer->isCanvas() || renderer->isVideo(); |
| 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(isHorizontalWritingMode() ? intrinsicSize :
intrinsicSize.transposedSize()); | 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 |
| 243 // opposite axis. So for example a maximum width that shrinks our width will
result in the height we compute here | 243 // opposite axis. So for example a maximum width that shrinks our width will
result in the height we compute here |
| 244 // having to shrink in order to preserve the aspect ratio. Because we comput
e these values independently along | 244 // having to shrink in order to preserve the aspect ratio. Because we comput
e these values independently along |
| 245 // each axis, the final returned size may in fact not preserve the aspect ra
tio. | 245 // each axis, the final returned size may in fact not preserve the aspect ra
tio. |
| 246 // FIXME: In the long term, it might be better to just return this code more
to the way it used to be before this | 246 // FIXME: In the long term, it might be better to just return this code more
to the way it used to be before this |
| 247 // function was added, since all it has done is make the code more unclear. | 247 // function was added, since all it has done is make the code more unclear. |
| 248 constrainedSize = intrinsicSize; | 248 constrainedSize = intrinsicSize; |
| 249 if (intrinsicRatio && !intrinsicSize.isEmpty() && style()->logicalWidth().is
Auto() && style()->logicalHeight().isAuto()) { | 249 if (intrinsicRatio && !intrinsicSize.isEmpty() && style()->logicalWidth().is
Auto() && style()->logicalHeight().isAuto()) { |
| 250 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests
, like fast/images/zoomed-img-size.html, which | 250 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests
, like fast/images/zoomed-img-size.html, which |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 PositionWithAffinity RenderReplaced::positionForPoint(const LayoutPoint& point) | 437 PositionWithAffinity RenderReplaced::positionForPoint(const LayoutPoint& point) |
| 438 { | 438 { |
| 439 // FIXME: This code is buggy if the replaced element is relative positioned. | 439 // FIXME: This code is buggy if the replaced element is relative positioned. |
| 440 InlineBox* box = inlineBoxWrapper(); | 440 InlineBox* box = inlineBoxWrapper(); |
| 441 RootInlineBox* rootBox = box ? &box->root() : 0; | 441 RootInlineBox* rootBox = box ? &box->root() : 0; |
| 442 | 442 |
| 443 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop(); | 443 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop(); |
| 444 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom(); | 444 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom(); |
| 445 | 445 |
| 446 LayoutUnit blockDirectionPosition = isHorizontalWritingMode() ? point.y() +
y() : point.x() + x(); | 446 LayoutUnit blockDirectionPosition = point.y() + y(); |
| 447 LayoutUnit lineDirectionPosition = isHorizontalWritingMode() ? point.x() + x
() : point.y() + y(); | 447 LayoutUnit lineDirectionPosition = point.x() + x(); |
| 448 | 448 |
| 449 if (blockDirectionPosition < top) | 449 if (blockDirectionPosition < top) |
| 450 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); // coor
dinates are above | 450 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); // coor
dinates are above |
| 451 | 451 |
| 452 if (blockDirectionPosition >= bottom) | 452 if (blockDirectionPosition >= bottom) |
| 453 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); // coor
dinates are below | 453 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); // coor
dinates are below |
| 454 | 454 |
| 455 if (node()) { | 455 if (node()) { |
| 456 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) | 456 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) |
| 457 return createPositionWithAffinity(0, DOWNSTREAM); | 457 return createPositionWithAffinity(0, DOWNSTREAM); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const | 536 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const |
| 537 { | 537 { |
| 538 // The selectionRect can project outside of the overflowRect, so take their
union | 538 // The selectionRect can project outside of the overflowRect, so take their
union |
| 539 // for paint invalidation to avoid selection painting glitches. | 539 // for paint invalidation to avoid selection painting glitches. |
| 540 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 540 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
| 541 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 541 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
| 542 return r; | 542 return r; |
| 543 } | 543 } |
| 544 | 544 |
| 545 } | 545 } |
| OLD | NEW |