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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // Figure out if we need to compute an intrinsic ratio. | 268 // Figure out if we need to compute an intrinsic ratio. |
269 if (intrinsicSize.isEmpty() || !rendererHasAspectRatio(this)) | 269 if (intrinsicSize.isEmpty() || !rendererHasAspectRatio(this)) |
270 return; | 270 return; |
271 | 271 |
272 intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); | 272 intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); |
273 } | 273 } |
274 | 274 |
275 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
ouldComputePreferred) const | 275 LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh
ouldComputePreferred) const |
276 { | 276 { |
277 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri
nsic()) | 277 if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntri
nsic()) |
278 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL
ogicalWidthUsing(style()->logicalWidth()), shouldComputePreferred); | 278 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedL
ogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePre
ferred); |
279 | 279 |
280 LayoutBox* contentRenderer = embeddedContentBox(); | 280 LayoutBox* contentRenderer = embeddedContentBox(); |
281 | 281 |
282 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html
#inline-replaced-width | 282 // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html
#inline-replaced-width |
283 double intrinsicRatio = 0; | 283 double intrinsicRatio = 0; |
284 FloatSize constrainedSize; | 284 FloatSize constrainedSize; |
285 computeAspectRatioInformationForLayoutBox(contentRenderer, constrainedSize,
intrinsicRatio); | 285 computeAspectRatioInformationForLayoutBox(contentRenderer, constrainedSize,
intrinsicRatio); |
286 | 286 |
287 if (style()->logicalWidth().isAuto()) { | 287 if (style()->logicalWidth().isAuto()) { |
288 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight
(); | 288 bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight
(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // has no intrinsic size, which is wrong per CSS 2.1, but matches our be
havior since a long time. | 331 // has no intrinsic size, which is wrong per CSS 2.1, but matches our be
havior since a long time. |
332 } | 332 } |
333 | 333 |
334 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidt
h(), shouldComputePreferred); | 334 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidt
h(), shouldComputePreferred); |
335 } | 335 } |
336 | 336 |
337 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const | 337 LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const |
338 { | 338 { |
339 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi
sudet.html#propdef-height | 339 // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/vi
sudet.html#propdef-height |
340 if (hasReplacedLogicalHeight()) | 340 if (hasReplacedLogicalHeight()) |
341 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace
dLogicalHeightUsing(style()->logicalHeight())); | 341 return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplace
dLogicalHeightUsing(MainOrPreferredSize, style()->logicalHeight())); |
342 | 342 |
343 LayoutBox* contentRenderer = embeddedContentBox(); | 343 LayoutBox* contentRenderer = embeddedContentBox(); |
344 | 344 |
345 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html
#inline-replaced-height | 345 // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html
#inline-replaced-height |
346 double intrinsicRatio = 0; | 346 double intrinsicRatio = 0; |
347 FloatSize constrainedSize; | 347 FloatSize constrainedSize; |
348 computeAspectRatioInformationForLayoutBox(contentRenderer, constrainedSize,
intrinsicRatio); | 348 computeAspectRatioInformationForLayoutBox(contentRenderer, constrainedSize,
intrinsicRatio); |
349 | 349 |
350 bool widthIsAuto = style()->logicalWidth().isAuto(); | 350 bool widthIsAuto = style()->logicalWidth().isAuto(); |
351 bool hasIntrinsicHeight = constrainedSize.height() > 0; | 351 bool hasIntrinsicHeight = constrainedSize.height() > 0; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 return LayoutRect(); | 509 return LayoutRect(); |
510 | 510 |
511 // The selectionRect can project outside of the overflowRect, so take their
union | 511 // The selectionRect can project outside of the overflowRect, so take their
union |
512 // for paint invalidation to avoid selection painting glitches. | 512 // for paint invalidation to avoid selection painting glitches. |
513 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 513 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
514 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 514 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
515 return r; | 515 return r; |
516 } | 516 } |
517 | 517 |
518 } | 518 } |
OLD | NEW |