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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 1781
1782 void appendContent(PassOwnPtr<ContentData>); 1782 void appendContent(PassOwnPtr<ContentData>);
1783 1783
1784 bool diffNeedsFullLayout(const RenderStyle& other) const; 1784 bool diffNeedsFullLayout(const RenderStyle& other) const;
1785 bool diffNeedsRepaintLayerOnly(const RenderStyle& other) const; 1785 bool diffNeedsRepaintLayerOnly(const RenderStyle& other) const;
1786 bool diffNeedsRepaintObjectOnly(const RenderStyle& other) const; 1786 bool diffNeedsRepaintObjectOnly(const RenderStyle& other) const;
1787 bool diffNeedsRecompositeLayerOnly(const RenderStyle& other) const; 1787 bool diffNeedsRecompositeLayerOnly(const RenderStyle& other) const;
1788 unsigned computeChangedContextSensitiveProperties(const RenderStyle& other, StyleDifference) const; 1788 unsigned computeChangedContextSensitiveProperties(const RenderStyle& other, StyleDifference) const;
1789 }; 1789 };
1790 1790
1791 inline int adjustForAbsoluteZoom(int value, float zoomFactor) 1791 inline int adjustForAbsoluteZoom(int value, float zoomFactor)
eae 2014/04/28 14:44:48 We really shouldn't be using ints for layout value
1792 { 1792 {
1793 if (zoomFactor == 1) 1793 if (zoomFactor == 1)
1794 return value; 1794 return value;
1795 // Needed because computeLengthInt truncates (rather than rounds) when scali ng up. 1795 // Needed because computeLengthInt truncates (rather than rounds) when scali ng up.
1796 float fvalue = value;
1796 if (zoomFactor > 1) { 1797 if (zoomFactor > 1) {
1797 if (value < 0) 1798 if (value < 0)
1798 value--; 1799 fvalue -= 0.5f;
1799 else 1800 else
1800 value++; 1801 fvalue += 0.5f;
1801 } 1802 }
1802 1803
1803 return roundForImpreciseConversion<int>(value / zoomFactor); 1804 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
1804 } 1805 }
1805 1806
1806 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style) 1807 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1807 { 1808 {
1808 return adjustForAbsoluteZoom(value, style->effectiveZoom()); 1809 return adjustForAbsoluteZoom(value, style->effectiveZoom());
1809 } 1810 }
1810 1811
1811 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style) 1812 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style)
1812 { 1813 {
1813 return value / style.effectiveZoom(); 1814 return value / style.effectiveZoom();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 inline bool RenderStyle::hasPseudoElementStyle() const 1876 inline bool RenderStyle::hasPseudoElementStyle() const
1876 { 1877 {
1877 return noninherited_flags._pseudoBits & PSEUDO_ELEMENT_MASK; 1878 return noninherited_flags._pseudoBits & PSEUDO_ELEMENT_MASK;
1878 } 1879 }
1879 1880
1880 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&); 1881 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&);
1881 1882
1882 } // namespace WebCore 1883 } // namespace WebCore
1883 1884
1884 #endif // RenderStyle_h 1885 #endif // RenderStyle_h
OLDNEW
« 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