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