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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 int RenderBoxModelObject::pixelSnappedOffsetWidth() const | 303 int RenderBoxModelObject::pixelSnappedOffsetWidth() const |
304 { | 304 { |
305 return snapSizeToPixel(offsetWidth(), offsetLeft()); | 305 return snapSizeToPixel(offsetWidth(), offsetLeft()); |
306 } | 306 } |
307 | 307 |
308 int RenderBoxModelObject::pixelSnappedOffsetHeight() const | 308 int RenderBoxModelObject::pixelSnappedOffsetHeight() const |
309 { | 309 { |
310 return snapSizeToPixel(offsetHeight(), offsetTop()); | 310 return snapSizeToPixel(offsetHeight(), offsetTop()); |
311 } | 311 } |
312 | 312 |
313 LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding) const | 313 LayoutUnit RenderBoxModelObject::computedCSSPadding(const Length& padding, Paddi ngType type) const |
314 { | 314 { |
315 LayoutUnit w = 0; | 315 LayoutUnit w = 0; |
316 if (padding.isPercent()) | 316 if (padding.isPercent()) { |
317 w = containingBlockLogicalWidthForContent(); | 317 if (containingBlock()->isFlexibleBox() && (type == TopPadding || type == BottomPadding || type == BeforePadding || type == AfterPadding)) |
318 w = containingBlockLogicalHeightForContent(); | |
319 else | |
320 w = containingBlockLogicalWidthForContent(); | |
321 } | |
318 return minimumValueForLength(padding, w); | 322 return minimumValueForLength(padding, w); |
319 } | 323 } |
320 | 324 |
321 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig ht, | 325 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig ht, |
322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 326 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
323 { | 327 { |
324 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical LeftEdge, includeLogicalRightEdge); | 328 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical LeftEdge, includeLogicalRightEdge); |
325 if (box && (box->nextLineBox() || box->prevLineBox())) { | 329 if (box && (box->nextLineBox() || box->prevLineBox())) { |
326 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0 , inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE dge); | 330 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0 , inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE dge); |
327 border.setRadii(segmentBorder.radii()); | 331 border.setRadii(segmentBorder.radii()); |
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2500 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges); | 2504 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges); |
2501 } | 2505 } |
2502 } | 2506 } |
2503 } | 2507 } |
2504 | 2508 |
2505 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const | 2509 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const |
2506 { | 2510 { |
2507 return containingBlock()->availableLogicalWidth(); | 2511 return containingBlock()->availableLogicalWidth(); |
2508 } | 2512 } |
2509 | 2513 |
2514 LayoutUnit RenderBoxModelObject::containingBlockLogicalHeightForContent() const | |
2515 { | |
2516 if (containingBlock()->style()->logicalHeight().isAuto()) | |
2517 return 0; | |
2518 | |
2519 if (containingBlock()->style()->logicalHeight().isPercent()) | |
2520 return containingBlock()->computePercentLogicalHeight(); | |
2521 | |
2522 return containingBlock()->logicalHeight() - containingBlock()->borderAndPadd ingLogicalHeight(); | |
2523 } | |
2524 | |
2525 LayoutUnit RenderBoxModelObject::computePercentLogicalHeight() const | |
tony
2014/07/14 16:34:38
I'm not sure this function is correct. For exampl
harpreet.sk
2014/07/15 16:31:01
I tried to go through the implementation of mozill
| |
2526 { | |
2527 float percentHeightFactor = style()->logicalHeight().value() / 100; | |
2528 RenderBlock* cb = containingBlock(); | |
2529 while (cb) { | |
2530 if (cb->style()->logicalHeight().isAuto()) | |
tony
2014/07/14 16:34:38
This should probably be !isSpecified().
Please ad
harpreet.sk
2014/07/15 16:31:01
Done.
| |
2531 return 0; | |
2532 if (cb->style()->logicalHeight().isFixed()) | |
2533 break; | |
2534 percentHeightFactor *= cb->style()->logicalHeight().value() / 100; | |
tony
2014/07/14 16:34:38
I think you want to verify that b->style()->logica
harpreet.sk
2014/07/15 16:31:00
Modifeid the solution to include check for all typ
| |
2535 cb = cb->containingBlock(); | |
2536 } | |
2537 | |
2538 if (cb) | |
2539 return percentHeightFactor * cb->style()->logicalHeight().value(); | |
2540 | |
2541 return 0; | |
2542 } | |
2543 | |
2510 RenderBoxModelObject* RenderBoxModelObject::continuation() const | 2544 RenderBoxModelObject* RenderBoxModelObject::continuation() const |
2511 { | 2545 { |
2512 if (!continuationMap) | 2546 if (!continuationMap) |
2513 return 0; | 2547 return 0; |
2514 return continuationMap->get(this); | 2548 return continuationMap->get(this); |
2515 } | 2549 } |
2516 | 2550 |
2517 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) | 2551 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) |
2518 { | 2552 { |
2519 if (continuation) { | 2553 if (continuation) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2730 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2764 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2731 for (RenderObject* child = startChild; child && child != endChild; ) { | 2765 for (RenderObject* child = startChild; child && child != endChild; ) { |
2732 // Save our next sibling as moveChildTo will clear it. | 2766 // Save our next sibling as moveChildTo will clear it. |
2733 RenderObject* nextSibling = child->nextSibling(); | 2767 RenderObject* nextSibling = child->nextSibling(); |
2734 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2768 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2735 child = nextSibling; | 2769 child = nextSibling; |
2736 } | 2770 } |
2737 } | 2771 } |
2738 | 2772 |
2739 } // namespace WebCore | 2773 } // namespace WebCore |
OLD | NEW |