Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / views / test / test_views.cc
index 0c391b0..320ec8e 100644 (file)
@@ -15,7 +15,7 @@ gfx::Size StaticSizedView::GetPreferredSize() const {
 }
 
 ProportionallySizedView::ProportionallySizedView(int factor)
-    : factor_(factor) {}
+    : factor_(factor), preferred_width_(-1) {}
 
 ProportionallySizedView::~ProportionallySizedView() {}
 
@@ -23,4 +23,10 @@ int ProportionallySizedView::GetHeightForWidth(int w) const {
   return w * factor_;
 }
 
+gfx::Size ProportionallySizedView::GetPreferredSize() const {
+  if (preferred_width_ >= 0)
+    return gfx::Size(preferred_width_, GetHeightForWidth(preferred_width_));
+  return View::GetPreferredSize();
+}
+
 }  // namespace views