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

Unified Diff: Source/core/rendering/style/RenderStyle.h

Issue 251063002: Use plus/minus 0.5 instead of 1 when calculating zoomed length. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « LayoutTests/fast/media/mq-width-on-zoom-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/RenderStyle.h
diff --git a/Source/core/rendering/style/RenderStyle.h b/Source/core/rendering/style/RenderStyle.h
index eb5496ea25990b2a81140b143f74c47db208e030..0c943f32ae86d8837694cbaec4031a7be6d17566 100644
--- a/Source/core/rendering/style/RenderStyle.h
+++ b/Source/core/rendering/style/RenderStyle.h
@@ -1788,19 +1788,22 @@ private:
unsigned computeChangedContextSensitiveProperties(const RenderStyle& other, StyleDifference) const;
};
+// FIXME: Reduce/remove the dependency on zoom adjusted int values.
+// The float or LayoutUnit versions of layout values should be used.
inline int adjustForAbsoluteZoom(int value, float zoomFactor)
{
if (zoomFactor == 1)
return value;
// Needed because computeLengthInt truncates (rather than rounds) when scaling up.
+ float fvalue = value;
if (zoomFactor > 1) {
if (value < 0)
- value--;
+ fvalue -= 0.5f;
else
- value++;
+ fvalue += 0.5f;
}
- return roundForImpreciseConversion<int>(value / zoomFactor);
+ return roundForImpreciseConversion<int>(fvalue / zoomFactor);
}
inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
« no previous file with comments | « LayoutTests/fast/media/mq-width-on-zoom-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698