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 "core/layout/LayoutReplaced.h" | 24 #include "core/layout/LayoutReplaced.h" |
25 | 25 |
26 #include "core/editing/PositionWithAffinity.h" | 26 #include "core/editing/PositionWithAffinity.h" |
27 #include "core/layout/LayoutAnalyzer.h" | 27 #include "core/layout/LayoutAnalyzer.h" |
28 #include "core/layout/LayoutBlock.h" | 28 #include "core/layout/LayoutBlock.h" |
29 #include "core/layout/LayoutImage.h" | 29 #include "core/layout/LayoutImage.h" |
| 30 #include "core/layout/LayoutInline.h" |
30 #include "core/layout/LayoutView.h" | 31 #include "core/layout/LayoutView.h" |
31 #include "core/paint/PaintInfo.h" | 32 #include "core/paint/PaintInfo.h" |
32 #include "core/paint/PaintLayer.h" | 33 #include "core/paint/PaintLayer.h" |
33 #include "core/paint/ReplacedPainter.h" | 34 #include "core/paint/ReplacedPainter.h" |
34 #include "platform/LengthFunctions.h" | 35 #include "platform/LengthFunctions.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 const int LayoutReplaced::defaultWidth = 300; | 39 const int LayoutReplaced::defaultWidth = 300; |
39 const int LayoutReplaced::defaultHeight = 150; | 40 const int LayoutReplaced::defaultHeight = 150; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // function was added, since all it has done is make the code more unclear. | 204 // function was added, since all it has done is make the code more unclear. |
204 constrainedSize = intrinsicSize; | 205 constrainedSize = intrinsicSize; |
205 if (intrinsicRatio && !intrinsicSize.isEmpty() && style()->logicalWidth().is
Auto() && style()->logicalHeight().isAuto()) { | 206 if (intrinsicRatio && !intrinsicSize.isEmpty() && style()->logicalWidth().is
Auto() && style()->logicalHeight().isAuto()) { |
206 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests
, like fast/images/zoomed-img-size.html, which | 207 // We can't multiply or divide by 'intrinsicRatio' here, it breaks tests
, like fast/images/zoomed-img-size.html, which |
207 // can only be fixed once subpixel precision is available for things lik
e intrinsicWidth/Height - which include zoom! | 208 // can only be fixed once subpixel precision is available for things lik
e intrinsicWidth/Height - which include zoom! |
208 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int
rinsicSize.width() / intrinsicSize.height()); | 209 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int
rinsicSize.width() / intrinsicSize.height()); |
209 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int
rinsicSize.height() / intrinsicSize.width()); | 210 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int
rinsicSize.height() / intrinsicSize.width()); |
210 } | 211 } |
211 } | 212 } |
212 | 213 |
| 214 void LayoutReplaced::computePositionedLogicalWidth(LogicalExtentComputedValues&
computedValues) const |
| 215 { |
| 216 // The following is based off of the W3C Working Draft from April 11, 2006 o
f |
| 217 // CSS 2.1: Section 10.3.8 "Absolutely positioned, replaced elements" |
| 218 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-replaced-wi
dth> |
| 219 // (block-style-comments in this function correspond to text from the spec a
nd |
| 220 // the numbers correspond to numbers in spec) |
| 221 |
| 222 // We don't use containingBlock(), since we may be positioned by an enclosin
g |
| 223 // relative positioned inline. |
| 224 const LayoutBoxModelObject* containerBlock = toLayoutBoxModelObject(containe
r()); |
| 225 |
| 226 const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPosit
ioned(containerBlock); |
| 227 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidth
ForPositioned(containerBlock, false); |
| 228 |
| 229 // To match WinIE, in quirks mode use the parent's 'direction' property |
| 230 // instead of the the container block's. |
| 231 TextDirection containerDirection = containerBlock->style()->direction(); |
| 232 |
| 233 // Variables to solve. |
| 234 bool isHorizontal = isHorizontalWritingMode(); |
| 235 Length logicalLeft = style()->logicalLeft(); |
| 236 Length logicalRight = style()->logicalRight(); |
| 237 Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->m
arginTop(); |
| 238 Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()-
>marginBottom(); |
| 239 LayoutUnit& marginLogicalLeftAlias = style()->isLeftToRightDirection() ? com
putedValues.m_margins.m_start : computedValues.m_margins.m_end; |
| 240 LayoutUnit& marginLogicalRightAlias = style()->isLeftToRightDirection() ? co
mputedValues.m_margins.m_end : computedValues.m_margins.m_start; |
| 241 |
| 242 /*-----------------------------------------------------------------------*\ |
| 243 * 1. The used value of 'width' is determined as for inline replaced |
| 244 * elements. |
| 245 \*-----------------------------------------------------------------------*/ |
| 246 // NOTE: This value of width is final in that the min/max width calculations |
| 247 // are dealt with in computeReplacedWidth(). This means that the steps to p
roduce |
| 248 // correct max/min in the non-replaced version, are not necessary. |
| 249 computedValues.m_extent = computeReplacedLogicalWidth() + borderAndPaddingLo
gicalWidth(); |
| 250 |
| 251 const LayoutUnit availableSpace = containerLogicalWidth - computedValues.m_e
xtent; |
| 252 |
| 253 /*-----------------------------------------------------------------------*\ |
| 254 * 2. If both 'left' and 'right' have the value 'auto', then if 'direction' |
| 255 * of the containing block is 'ltr', set 'left' to the static position; |
| 256 * else if 'direction' is 'rtl', set 'right' to the static position. |
| 257 \*-----------------------------------------------------------------------*/ |
| 258 // see FIXME 1 |
| 259 computeInlineStaticDistance(logicalLeft, logicalRight, this, containerBlock,
containerLogicalWidth); |
| 260 |
| 261 /*-----------------------------------------------------------------------*\ |
| 262 * 3. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left' |
| 263 * or 'margin-right' with '0'. |
| 264 \*-----------------------------------------------------------------------*/ |
| 265 if (logicalLeft.isAuto() || logicalRight.isAuto()) { |
| 266 if (marginLogicalLeft.isAuto()) |
| 267 marginLogicalLeft.setValue(Fixed, 0); |
| 268 if (marginLogicalRight.isAuto()) |
| 269 marginLogicalRight.setValue(Fixed, 0); |
| 270 } |
| 271 |
| 272 /*-----------------------------------------------------------------------*\ |
| 273 * 4. If at this point both 'margin-left' and 'margin-right' are still |
| 274 * 'auto', solve the equation under the extra constraint that the two |
| 275 * margins must get equal values, unless this would make them negative, |
| 276 * in which case when the direction of the containing block is 'ltr' |
| 277 * ('rtl'), set 'margin-left' ('margin-right') to zero and solve for |
| 278 * 'margin-right' ('margin-left'). |
| 279 \*-----------------------------------------------------------------------*/ |
| 280 LayoutUnit logicalLeftValue = 0; |
| 281 LayoutUnit logicalRightValue = 0; |
| 282 |
| 283 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { |
| 284 // 'left' and 'right' cannot be 'auto' due to step 3 |
| 285 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); |
| 286 |
| 287 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
| 288 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
| 289 |
| 290 LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRigh
tValue); |
| 291 if (difference > 0) { |
| 292 marginLogicalLeftAlias = difference / 2; // split the difference |
| 293 marginLogicalRightAlias = difference - marginLogicalLeftAlias; // ac
count for odd valued differences |
| 294 } else { |
| 295 // Use the containing block's direction rather than the parent block
's |
| 296 // per CSS 2.1 reference test abspos-replaced-width-margin-000. |
| 297 if (containerDirection == LTR) { |
| 298 marginLogicalLeftAlias = 0; |
| 299 marginLogicalRightAlias = difference; // will be negative |
| 300 } else { |
| 301 marginLogicalLeftAlias = difference; // will be negative |
| 302 marginLogicalRightAlias = 0; |
| 303 } |
| 304 } |
| 305 |
| 306 /*-----------------------------------------------------------------------*\ |
| 307 * 5. If at this point there is an 'auto' left, solve the equation for |
| 308 * that value. |
| 309 \*-----------------------------------------------------------------------*/ |
| 310 } else if (logicalLeft.isAuto()) { |
| 311 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRela
tiveLogicalWidth); |
| 312 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRe
lativeLogicalWidth); |
| 313 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
| 314 |
| 315 // Solve for 'left' |
| 316 logicalLeftValue = availableSpace - (logicalRightValue + marginLogicalLe
ftAlias + marginLogicalRightAlias); |
| 317 } else if (logicalRight.isAuto()) { |
| 318 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRela
tiveLogicalWidth); |
| 319 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRe
lativeLogicalWidth); |
| 320 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
| 321 |
| 322 // Solve for 'right' |
| 323 logicalRightValue = availableSpace - (logicalLeftValue + marginLogicalLe
ftAlias + marginLogicalRightAlias); |
| 324 } else if (marginLogicalLeft.isAuto()) { |
| 325 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRe
lativeLogicalWidth); |
| 326 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
| 327 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
| 328 |
| 329 // Solve for 'margin-left' |
| 330 marginLogicalLeftAlias = availableSpace - (logicalLeftValue + logicalRig
htValue + marginLogicalRightAlias); |
| 331 } else if (marginLogicalRight.isAuto()) { |
| 332 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRela
tiveLogicalWidth); |
| 333 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
| 334 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
| 335 |
| 336 // Solve for 'margin-right' |
| 337 marginLogicalRightAlias = availableSpace - (logicalLeftValue + logicalRi
ghtValue + marginLogicalLeftAlias); |
| 338 } else { |
| 339 // Nothing is 'auto', just calculate the values. |
| 340 marginLogicalLeftAlias = valueForLength(marginLogicalLeft, containerRela
tiveLogicalWidth); |
| 341 marginLogicalRightAlias = valueForLength(marginLogicalRight, containerRe
lativeLogicalWidth); |
| 342 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); |
| 343 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); |
| 344 // If the containing block is right-to-left, then push the left position
as far to the right as possible |
| 345 if (containerDirection == RTL) { |
| 346 int totalLogicalWidth = computedValues.m_extent + logicalLeftValue +
logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias; |
| 347 logicalLeftValue = containerLogicalWidth - (totalLogicalWidth - logi
calLeftValue); |
| 348 } |
| 349 } |
| 350 |
| 351 /*-----------------------------------------------------------------------*\ |
| 352 * 6. If at this point the values are over-constrained, ignore the value |
| 353 * for either 'left' (in case the 'direction' property of the |
| 354 * containing block is 'rtl') or 'right' (in case 'direction' is |
| 355 * 'ltr') and solve for that value. |
| 356 \*-----------------------------------------------------------------------*/ |
| 357 // NOTE: Constraints imposed by the width of the containing block and its co
ntent have already been accounted for above. |
| 358 |
| 359 // FIXME: Deal with differing writing modes here. Our offset needs to be in
the containing block's coordinate space, so that |
| 360 // can make the result here rather complicated to compute. |
| 361 |
| 362 // Use computed values to calculate the horizontal position. |
| 363 |
| 364 // FIXME: This hack is needed to calculate the logical left position for a '
rtl' relatively |
| 365 // positioned, inline containing block because right now, it is using the lo
gical left position |
| 366 // of the first line box when really it should use the last line box. When |
| 367 // this is fixed elsewhere, this block should be removed. |
| 368 if (containerBlock->isLayoutInline() && !containerBlock->style()->isLeftToRi
ghtDirection()) { |
| 369 const LayoutInline* flow = toLayoutInline(containerBlock); |
| 370 InlineFlowBox* firstLine = flow->firstLineBox(); |
| 371 InlineFlowBox* lastLine = flow->lastLineBox(); |
| 372 if (firstLine && lastLine && firstLine != lastLine) { |
| 373 computedValues.m_position = logicalLeftValue + marginLogicalLeftAlia
s + lastLine->borderLogicalLeft() + (lastLine->logicalLeft() - firstLine->logica
lLeft()); |
| 374 return; |
| 375 } |
| 376 } |
| 377 |
| 378 LayoutUnit logicalLeftPos = logicalLeftValue + marginLogicalLeftAlias; |
| 379 computeLogicalLeftPositionedOffset(logicalLeftPos, this, computedValues.m_ex
tent, containerBlock, containerLogicalWidth); |
| 380 computedValues.m_position = logicalLeftPos; |
| 381 } |
| 382 |
| 383 void LayoutReplaced::computePositionedLogicalHeight(LogicalExtentComputedValues&
computedValues) const |
| 384 { |
| 385 // The following is based off of the W3C Working Draft from April 11, 2006 o
f |
| 386 // CSS 2.1: Section 10.6.5 "Absolutely positioned, replaced elements" |
| 387 // <http://www.w3.org/TR/2005/WD-CSS21-20050613/visudet.html#abs-replaced-he
ight> |
| 388 // (block-style-comments in this function correspond to text from the spec a
nd |
| 389 // the numbers correspond to numbers in spec) |
| 390 |
| 391 // We don't use containingBlock(), since we may be positioned by an enclosin
g relpositioned inline. |
| 392 const LayoutBoxModelObject* containerBlock = toLayoutBoxModelObject(containe
r()); |
| 393 |
| 394 const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPos
itioned(containerBlock); |
| 395 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidth
ForPositioned(containerBlock, false); |
| 396 |
| 397 // Variables to solve. |
| 398 Length marginBefore = style()->marginBefore(); |
| 399 Length marginAfter = style()->marginAfter(); |
| 400 LayoutUnit& marginBeforeAlias = computedValues.m_margins.m_before; |
| 401 LayoutUnit& marginAfterAlias = computedValues.m_margins.m_after; |
| 402 |
| 403 Length logicalTop = style()->logicalTop(); |
| 404 Length logicalBottom = style()->logicalBottom(); |
| 405 |
| 406 /*-----------------------------------------------------------------------*\ |
| 407 * 1. The used value of 'height' is determined as for inline replaced |
| 408 * elements. |
| 409 \*-----------------------------------------------------------------------*/ |
| 410 // NOTE: This value of height is final in that the min/max height calculatio
ns |
| 411 // are dealt with in computeReplacedHeight(). This means that the steps to
produce |
| 412 // correct max/min in the non-replaced version, are not necessary. |
| 413 computedValues.m_extent = computeReplacedLogicalHeight() + borderAndPaddingL
ogicalHeight(); |
| 414 const LayoutUnit availableSpace = containerLogicalHeight - computedValues.m_
extent; |
| 415 |
| 416 /*-----------------------------------------------------------------------*\ |
| 417 * 2. If both 'top' and 'bottom' have the value 'auto', replace 'top' |
| 418 * with the element's static position. |
| 419 \*-----------------------------------------------------------------------*/ |
| 420 // see FIXME 1 |
| 421 computeBlockStaticDistance(logicalTop, logicalBottom, this, containerBlock); |
| 422 |
| 423 /*-----------------------------------------------------------------------*\ |
| 424 * 3. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or |
| 425 * 'margin-bottom' with '0'. |
| 426 \*-----------------------------------------------------------------------*/ |
| 427 // FIXME: The spec. says that this step should only be taken when bottom is |
| 428 // auto, but if only top is auto, this makes step 4 impossible. |
| 429 if (logicalTop.isAuto() || logicalBottom.isAuto()) { |
| 430 if (marginBefore.isAuto()) |
| 431 marginBefore.setValue(Fixed, 0); |
| 432 if (marginAfter.isAuto()) |
| 433 marginAfter.setValue(Fixed, 0); |
| 434 } |
| 435 |
| 436 /*-----------------------------------------------------------------------*\ |
| 437 * 4. If at this point both 'margin-top' and 'margin-bottom' are still |
| 438 * 'auto', solve the equation under the extra constraint that the two |
| 439 * margins must get equal values. |
| 440 \*-----------------------------------------------------------------------*/ |
| 441 LayoutUnit logicalTopValue = 0; |
| 442 LayoutUnit logicalBottomValue = 0; |
| 443 |
| 444 if (marginBefore.isAuto() && marginAfter.isAuto()) { |
| 445 // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined. |
| 446 ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto())); |
| 447 |
| 448 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); |
| 449 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh
t); |
| 450 |
| 451 LayoutUnit difference = availableSpace - (logicalTopValue + logicalBotto
mValue); |
| 452 // NOTE: This may result in negative values. |
| 453 marginBeforeAlias = difference / 2; // split the difference |
| 454 marginAfterAlias = difference - marginBeforeAlias; // account for odd va
lued differences |
| 455 |
| 456 /*-----------------------------------------------------------------------*\ |
| 457 * 5. If at this point there is only one 'auto' left, solve the equation |
| 458 * for that value. |
| 459 \*-----------------------------------------------------------------------*/ |
| 460 } else if (logicalTop.isAuto()) { |
| 461 marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogica
lWidth); |
| 462 marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalW
idth); |
| 463 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh
t); |
| 464 |
| 465 // Solve for 'top' |
| 466 logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAli
as + marginAfterAlias); |
| 467 } else if (logicalBottom.isAuto()) { |
| 468 marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogica
lWidth); |
| 469 marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalW
idth); |
| 470 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); |
| 471 |
| 472 // Solve for 'bottom' |
| 473 // NOTE: It is not necessary to solve for 'bottom' because we don't ever |
| 474 // use the value. |
| 475 } else if (marginBefore.isAuto()) { |
| 476 marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalW
idth); |
| 477 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); |
| 478 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh
t); |
| 479 |
| 480 // Solve for 'margin-top' |
| 481 marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomVal
ue + marginAfterAlias); |
| 482 } else if (marginAfter.isAuto()) { |
| 483 marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogica
lWidth); |
| 484 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); |
| 485 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh
t); |
| 486 |
| 487 // Solve for 'margin-bottom' |
| 488 marginAfterAlias = availableSpace - (logicalTopValue + logicalBottomValu
e + marginBeforeAlias); |
| 489 } else { |
| 490 // Nothing is 'auto', just calculate the values. |
| 491 marginBeforeAlias = valueForLength(marginBefore, containerRelativeLogica
lWidth); |
| 492 marginAfterAlias = valueForLength(marginAfter, containerRelativeLogicalW
idth); |
| 493 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); |
| 494 // NOTE: It is not necessary to solve for 'bottom' because we don't ever |
| 495 // use the value. |
| 496 } |
| 497 |
| 498 /*-----------------------------------------------------------------------*\ |
| 499 * 6. If at this point the values are over-constrained, ignore the value |
| 500 * for 'bottom' and solve for that value. |
| 501 \*-----------------------------------------------------------------------*/ |
| 502 // NOTE: It is not necessary to do this step because we don't end up using |
| 503 // the value of 'bottom' regardless of whether the values are over-constrain
ed |
| 504 // or not. |
| 505 |
| 506 // Use computed values to calculate the vertical position. |
| 507 LayoutUnit logicalTopPos = logicalTopValue + marginBeforeAlias; |
| 508 computeLogicalTopPositionedOffset(logicalTopPos, this, computedValues.m_exte
nt, containerBlock, containerLogicalHeight); |
| 509 computedValues.m_position = logicalTopPos; |
| 510 } |
| 511 |
213 LayoutRect LayoutReplaced::replacedContentRect(const LayoutSize* overriddenIntri
nsicSize) const | 512 LayoutRect LayoutReplaced::replacedContentRect(const LayoutSize* overriddenIntri
nsicSize) const |
214 { | 513 { |
215 LayoutRect contentRect = contentBoxRect(); | 514 LayoutRect contentRect = contentBoxRect(); |
216 ObjectFit objectFit = style()->objectFit(); | 515 ObjectFit objectFit = style()->objectFit(); |
217 | 516 |
218 if (objectFit == ObjectFitFill && style()->objectPosition() == ComputedStyle
::initialObjectPosition()) { | 517 if (objectFit == ObjectFitFill && style()->objectPosition() == ComputedStyle
::initialObjectPosition()) { |
219 return contentRect; | 518 return contentRect; |
220 } | 519 } |
221 | 520 |
222 // TODO(davve): intrinsicSize doubles as both intrinsic size and intrinsic r
atio. In the case of | 521 // TODO(davve): intrinsicSize doubles as both intrinsic size and intrinsic r
atio. In the case of |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the | 768 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the |
470 // image is selected. Since the selection state has changed update the rect. | 769 // image is selected. Since the selection state has changed update the rect. |
471 if (hasLayer()) | 770 if (hasLayer()) |
472 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); | 771 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); |
473 | 772 |
474 if (canUpdateSelectionOnRootLineBoxes()) | 773 if (canUpdateSelectionOnRootLineBoxes()) |
475 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); | 774 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); |
476 } | 775 } |
477 | 776 |
478 } | 777 } |
OLD | NEW |