OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 int RenderBoxModelObject::pixelSnappedOffsetWidth() const | 305 int RenderBoxModelObject::pixelSnappedOffsetWidth() const |
306 { | 306 { |
307 return snapSizeToPixel(offsetWidth(), offsetLeft()); | 307 return snapSizeToPixel(offsetWidth(), offsetLeft()); |
308 } | 308 } |
309 | 309 |
310 int RenderBoxModelObject::pixelSnappedOffsetHeight() const | 310 int RenderBoxModelObject::pixelSnappedOffsetHeight() const |
311 { | 311 { |
312 return snapSizeToPixel(offsetHeight(), offsetTop()); | 312 return snapSizeToPixel(offsetHeight(), offsetTop()); |
313 } | 313 } |
314 | 314 |
315 LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const | 315 LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding, Paddi
ngType type) const |
316 { | 316 { |
317 LayoutUnit w = 0; | 317 LayoutUnit w = 0; |
318 if (padding.isPercent()) | 318 if (padding.isPercent()) { |
319 w = containingBlockLogicalWidthForContent(); | 319 if (containingBlock()->isFlexibleBox() && RuntimeEnabledFeatures::vertic
alPaddingEnabled()) { |
| 320 if (type == TopPadding || type == BottomPadding || type == BeforePad
ding || type == AfterPadding) |
| 321 w = containingBlockLogicalHeightForPadding(); |
| 322 else |
| 323 w = containingBlockLogicalWidthForContent(); |
| 324 } else { |
| 325 w = containingBlockLogicalWidthForContent(); |
| 326 } |
| 327 } |
320 return minimumValueForLength(padding, w); | 328 return minimumValueForLength(padding, w); |
321 } | 329 } |
322 | 330 |
323 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor
derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig
ht, | 331 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor
derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig
ht, |
324 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 332 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
325 { | 333 { |
326 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical
LeftEdge, includeLogicalRightEdge); | 334 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical
LeftEdge, includeLogicalRightEdge); |
327 if (box && (box->nextLineBox() || box->prevLineBox())) { | 335 if (box && (box->nextLineBox() || box->prevLineBox())) { |
328 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0
, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE
dge); | 336 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0
, inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE
dge); |
329 border.setRadii(segmentBorder.radii()); | 337 border.setRadii(segmentBorder.radii()); |
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO
ffset), shadowBlur, shadowSpread, clippedEdges); | 2504 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO
ffset), shadowBlur, shadowSpread, clippedEdges); |
2497 } | 2505 } |
2498 } | 2506 } |
2499 } | 2507 } |
2500 | 2508 |
2501 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 2509 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const |
2502 { | 2510 { |
2503 return containingBlock()->availableLogicalWidth(); | 2511 return containingBlock()->availableLogicalWidth(); |
2504 } | 2512 } |
2505 | 2513 |
| 2514 LayoutUnit RenderBoxModelObject::containingBlockLogicalHeightForPadding() const |
| 2515 { |
| 2516 switch (containingBlock()->style()->logicalHeight().type()) { |
| 2517 case Auto: |
| 2518 case MinContent: |
| 2519 case MaxContent: |
| 2520 case FitContent: |
| 2521 case FillAvailable: |
| 2522 case Intrinsic: |
| 2523 case MinIntrinsic: |
| 2524 case MaxSizeNone: |
| 2525 case ExtendToZoom: |
| 2526 case DeviceWidth: |
| 2527 case DeviceHeight: |
| 2528 return 0; |
| 2529 case Fixed: |
| 2530 case Calculated: |
| 2531 return containingBlock()->style()->logicalHeight().value(); |
| 2532 case Percent: |
| 2533 return std::max<LayoutUnit>(containingBlock()->computePercentageLogicalH
eight(containingBlock()->style()->logicalHeight()), 0); |
| 2534 } |
| 2535 |
| 2536 ASSERT_NOT_REACHED(); |
| 2537 return 0; |
| 2538 } |
| 2539 |
2506 RenderBoxModelObject* RenderBoxModelObject::continuation() const | 2540 RenderBoxModelObject* RenderBoxModelObject::continuation() const |
2507 { | 2541 { |
2508 if (!continuationMap) | 2542 if (!continuationMap) |
2509 return 0; | 2543 return 0; |
2510 return (*continuationMap)->get(this); | 2544 return (*continuationMap)->get(this); |
2511 } | 2545 } |
2512 | 2546 |
2513 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) | 2547 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) |
2514 { | 2548 { |
2515 if (continuation) { | 2549 if (continuation) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2758 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2725 for (RenderObject* child = startChild; child && child != endChild; ) { | 2759 for (RenderObject* child = startChild; child && child != endChild; ) { |
2726 // Save our next sibling as moveChildTo will clear it. | 2760 // Save our next sibling as moveChildTo will clear it. |
2727 RenderObject* nextSibling = child->nextSibling(); | 2761 RenderObject* nextSibling = child->nextSibling(); |
2728 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2762 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2729 child = nextSibling; | 2763 child = nextSibling; |
2730 } | 2764 } |
2731 } | 2765 } |
2732 | 2766 |
2733 } // namespace blink | 2767 } // namespace blink |
OLD | NEW |