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

Side by Side Diff: sky/engine/core/css/CSSToLengthConversionData.cpp

Issue 711203002: Remove zoom() and effectiveZoom(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/css/CSSToLengthConversionData.h ('k') | sky/engine/core/css/CSSValuePool.h » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/css/CSSToLengthConversionData.h" 32 #include "core/css/CSSToLengthConversionData.h"
33 33
34 #include "core/rendering/RenderView.h" 34 #include "core/rendering/RenderView.h"
35 #include "core/rendering/style/RenderStyle.h" 35 #include "core/rendering/style/RenderStyle.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, c onst RenderStyle* rootStyle, const RenderView* renderView, float zoom, bool comp utingFontSize)
40 : m_style(style)
41 , m_rootStyle(rootStyle)
42 , m_viewportWidth(renderView ? renderView->layoutViewportWidth() : 0)
43 , m_viewportHeight(renderView ? renderView->layoutViewportHeight() : 0)
44 , m_zoom(zoom)
45 , m_useEffectiveZoom(false)
46 , m_computingFontSize(computingFontSize)
47 {
48 ASSERT(zoom > 0);
49 }
50
51 CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, c onst RenderStyle* rootStyle, const RenderView* renderView, bool computingFontSiz e) 39 CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, c onst RenderStyle* rootStyle, const RenderView* renderView, bool computingFontSiz e)
52 : m_style(style) 40 : m_style(style)
53 , m_rootStyle(rootStyle) 41 , m_rootStyle(rootStyle)
54 , m_viewportWidth(renderView ? renderView->layoutViewportWidth() : 0) 42 , m_viewportWidth(renderView ? renderView->layoutViewportWidth() : 0)
55 , m_viewportHeight(renderView ? renderView->layoutViewportHeight() : 0) 43 , m_viewportHeight(renderView ? renderView->layoutViewportHeight() : 0)
56 , m_useEffectiveZoom(true)
57 , m_computingFontSize(computingFontSize) 44 , m_computingFontSize(computingFontSize)
58 { 45 {
59 } 46 }
60 47
61 CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, c onst RenderStyle* rootStyle, float viewportWidth, float viewportHeight, float zo om, bool computingFontSize)
62 : m_style(style)
63 , m_rootStyle(rootStyle)
64 , m_viewportWidth(viewportWidth)
65 , m_viewportHeight(viewportHeight)
66 , m_zoom(zoom)
67 , m_useEffectiveZoom(false)
68 , m_computingFontSize(computingFontSize)
69 {
70 ASSERT(zoom > 0);
71 }
72
73 float CSSToLengthConversionData::zoom() const
74 {
75 if (m_useEffectiveZoom)
76 return m_style ? m_style->effectiveZoom() : 1;
77 return m_zoom;
78 }
79
80 double CSSToLengthConversionData::viewportWidthPercent() const 48 double CSSToLengthConversionData::viewportWidthPercent() const
81 { 49 {
82 m_style->setHasViewportUnits(); 50 m_style->setHasViewportUnits();
83 return m_viewportWidth / 100; 51 return m_viewportWidth / 100;
84 } 52 }
85 double CSSToLengthConversionData::viewportHeightPercent() const 53 double CSSToLengthConversionData::viewportHeightPercent() const
86 { 54 {
87 m_style->setHasViewportUnits(); 55 m_style->setHasViewportUnits();
88 return m_viewportHeight / 100; 56 return m_viewportHeight / 100;
89 } 57 }
90 double CSSToLengthConversionData::viewportMinPercent() const 58 double CSSToLengthConversionData::viewportMinPercent() const
91 { 59 {
92 m_style->setHasViewportUnits(); 60 m_style->setHasViewportUnits();
93 return std::min(m_viewportWidth, m_viewportHeight) / 100; 61 return std::min(m_viewportWidth, m_viewportHeight) / 100;
94 } 62 }
95 double CSSToLengthConversionData::viewportMaxPercent() const 63 double CSSToLengthConversionData::viewportMaxPercent() const
96 { 64 {
97 m_style->setHasViewportUnits(); 65 m_style->setHasViewportUnits();
98 return std::max(m_viewportWidth, m_viewportHeight) / 100; 66 return std::max(m_viewportWidth, m_viewportHeight) / 100;
99 } 67 }
100 68
101 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSToLengthConversionData.h ('k') | sky/engine/core/css/CSSValuePool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698