Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 385583005: For flex items, percent paddings should resolve against their respective dimension Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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, bool isTopOrBottomOrAfterOrBeforePadding) const
314 { 314 {
315 LayoutUnit w = 0; 315 LayoutUnit w = 0;
316 if (padding.isPercent()) 316 if (padding.isPercent())
317 w = containingBlockLogicalWidthForContent(); 317 w = (containingBlock()->isFlexibleBox() && isTopOrBottomOrAfterOrBeforeP adding)?containingBlockLogicalHeightForContent():containingBlockLogicalWidthForC ontent();
tony 2014/07/10 17:10:06 There should be spaces around the ? and :.
harpreet.sk 2014/07/14 08:38:07 Done.
318 return minimumValueForLength(padding, w); 318 return minimumValueForLength(padding, w);
319 } 319 }
320 320
321 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig ht, 321 RoundedRect RenderBoxModelObject::getBackgroundRoundedRect(const LayoutRect& bor derRect, InlineFlowBox* box, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeig ht,
322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const 322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
323 { 323 {
324 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical LeftEdge, includeLogicalRightEdge); 324 RoundedRect border = style()->getRoundedBorderFor(borderRect, includeLogical LeftEdge, includeLogicalRightEdge);
325 if (box && (box->nextLineBox() || box->prevLineBox())) { 325 if (box && (box->nextLineBox() || box->prevLineBox())) {
326 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0 , inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE dge); 326 RoundedRect segmentBorder = style()->getRoundedBorderFor(LayoutRect(0, 0 , inlineBoxWidth, inlineBoxHeight), includeLogicalLeftEdge, includeLogicalRightE dge);
327 border.setRadii(segmentBorder.radii()); 327 border.setRadii(segmentBorder.radii());
(...skipping 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges); 2500 context->drawInnerShadow(border, shadowColor, flooredIntSize(shadowO ffset), shadowBlur, shadowSpread, clippedEdges);
2501 } 2501 }
2502 } 2502 }
2503 } 2503 }
2504 2504
2505 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const 2505 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const
2506 { 2506 {
2507 return containingBlock()->availableLogicalWidth(); 2507 return containingBlock()->availableLogicalWidth();
2508 } 2508 }
2509 2509
2510 LayoutUnit RenderBoxModelObject::containingBlockLogicalHeightForContent() const
2511 {
2512 return containingBlock()->logicalHeight() - containingBlock()->borderAndPadd ingLogicalHeight();
tony 2014/07/10 17:10:06 Does this always work? We might not have computed
harpreet.sk 2014/07/14 08:38:07 This will not work always. Uploaded new solution.
2513 }
2514
2510 RenderBoxModelObject* RenderBoxModelObject::continuation() const 2515 RenderBoxModelObject* RenderBoxModelObject::continuation() const
2511 { 2516 {
2512 if (!continuationMap) 2517 if (!continuationMap)
2513 return 0; 2518 return 0;
2514 return continuationMap->get(this); 2519 return continuationMap->get(this);
2515 } 2520 }
2516 2521
2517 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) 2522 void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation)
2518 { 2523 {
2519 if (continuation) { 2524 if (continuation) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2735 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2731 for (RenderObject* child = startChild; child && child != endChild; ) { 2736 for (RenderObject* child = startChild; child && child != endChild; ) {
2732 // Save our next sibling as moveChildTo will clear it. 2737 // Save our next sibling as moveChildTo will clear it.
2733 RenderObject* nextSibling = child->nextSibling(); 2738 RenderObject* nextSibling = child->nextSibling();
2734 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2739 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2735 child = nextSibling; 2740 child = nextSibling;
2736 } 2741 }
2737 } 2742 }
2738 2743
2739 } // namespace WebCore 2744 } // namespace WebCore
OLDNEW
« Source/core/rendering/RenderBoxModelObject.h ('K') | « Source/core/rendering/RenderBoxModelObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698