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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 61fad6199d87245b7d5b117528fce8994b9c6100..0efbf131a6fe318b113e2349e70d6ca66f9830f1 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -591,6 +591,19 @@ void LayoutBox::updateLayerTransformAfterLayout()
layer()->updateTransformationMatrix();
}
+LayoutUnit LayoutBox::snapContentLogicalWidth() const
+{
+ LayoutUnit width = contentLogicalWidth();
+ if (width <= 0)
+ return width;
+ LayoutUnit unit = styleRef().snapWidth();
+ ASSERT(unit > 0);
+ LayoutUnit mod = intMod(width, unit);
+ if (!mod)
+ return width;
+ return LayoutUnit((width - mod).ceil());
+}
+
LayoutUnit LayoutBox::constrainLogicalWidthByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, LayoutBlock* cb) const
{
const ComputedStyle& styleToUse = styleRef();
« 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