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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1737453002: WIP: snap-width Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 quads.append(localToAbsoluteQuad(FloatRect(0, 0, m_frameRect.width().toFloat (), m_frameRect.height().toFloat()))); 584 quads.append(localToAbsoluteQuad(FloatRect(0, 0, m_frameRect.width().toFloat (), m_frameRect.height().toFloat())));
585 } 585 }
586 586
587 void LayoutBox::updateLayerTransformAfterLayout() 587 void LayoutBox::updateLayerTransformAfterLayout()
588 { 588 {
589 // Transform-origin depends on box size, so we need to update the layer tran sform after layout. 589 // Transform-origin depends on box size, so we need to update the layer tran sform after layout.
590 if (hasLayer()) 590 if (hasLayer())
591 layer()->updateTransformationMatrix(); 591 layer()->updateTransformationMatrix();
592 } 592 }
593 593
594 LayoutUnit LayoutBox::snapContentLogicalWidth() const
595 {
596 LayoutUnit width = contentLogicalWidth();
597 if (width <= 0)
598 return width;
599 LayoutUnit unit = styleRef().snapWidth();
600 ASSERT(unit > 0);
601 LayoutUnit mod = intMod(width, unit);
602 if (!mod)
603 return width;
604 return LayoutUnit((width - mod).ceil());
605 }
606
594 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay outUnit availableWidth, LayoutBlock* cb) const 607 LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, Lay outUnit availableWidth, LayoutBlock* cb) const
595 { 608 {
596 const ComputedStyle& styleToUse = styleRef(); 609 const ComputedStyle& styleToUse = styleRef();
597 if (!styleToUse.logicalMaxWidth().isMaxSizeNone()) 610 if (!styleToUse.logicalMaxWidth().isMaxSizeNone())
598 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize, styleToUse.logicalMaxWidth(), availableWidth, cb)); 611 logicalWidth = std::min(logicalWidth, computeLogicalWidthUsing(MaxSize, styleToUse.logicalMaxWidth(), availableWidth, cb));
599 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse.l ogicalMinWidth(), availableWidth, cb)); 612 return std::max(logicalWidth, computeLogicalWidthUsing(MinSize, styleToUse.l ogicalMinWidth(), availableWidth, cb));
600 } 613 }
601 614
602 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L ayoutUnit intrinsicContentHeight) const 615 LayoutUnit LayoutBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, L ayoutUnit intrinsicContentHeight) const
603 { 616 {
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 4753
4741 void LayoutBox::clearPercentHeightDescendants() 4754 void LayoutBox::clearPercentHeightDescendants()
4742 { 4755 {
4743 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4756 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4744 if (curr->isBox()) 4757 if (curr->isBox())
4745 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4758 toLayoutBox(curr)->removeFromPercentHeightContainer();
4746 } 4759 }
4747 } 4760 }
4748 4761
4749 } // namespace blink 4762 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698