Fixed logic calculating absoulute bounds.
authorKeuckdo Bang <keuckdo.bang@samsung.net>
Tue, 19 Mar 2013 06:07:10 +0000 (15:07 +0900)
committerKeuckdo Bang <keuckdo.bang@samsung.net>
Tue, 19 Mar 2013 08:18:35 +0000 (17:18 +0900)
Change-Id: I0536e4a7bd43b40b889f5643538325e249d686ad

src/ui/FUi_Control.cpp
src/ui/inc/FUi_Control.h

index a40edeb..b70ec64 100644 (file)
@@ -2887,6 +2887,55 @@ _Control::UpdateBoundsOfVisualElement(const FloatRectangle& controlBounds)
        return E_SUCCESS;
 }
 
+result
+_Control::AdjustAbsoluteBounds(void)
+{
+       result r = E_SUCCESS;
+
+       struct _Visitor
+               : public Visitor
+       {
+               _Visitor(_Control* pControl)
+                       : __pControl(pControl){}
+
+               virtual VisitType Visit(_Control& control)
+               {
+                       result r = E_SUCCESS;
+
+                       if (__pControl == &control)
+                       {
+                               return VISIT_DOWNWARD;
+                       }
+                       FloatRectangle fbounds = control.GetBoundsF();
+                       if (control.IsLayoutChangable() == false)
+                       {
+                               r = control.UpdateBoundsOfVisualElement(FloatRectangle(0.0f, 0.0f, fbounds.width, fbounds.height));
+                       }
+                       else
+                       {
+                               r = control.UpdateBoundsOfVisualElement(fbounds);
+                       }
+
+                       ControlList& children = control.GetChildList();
+
+                       int childrenCount = children.GetCount();
+                       if (childrenCount <= 0)
+                       {
+                               return VISIT_STOP;
+                       }
+                       else
+                       {
+                               return VISIT_DOWNWARD;
+                       }
+               }
+       private :
+               _Control* __pControl;
+       };
+
+       _Visitor visitor(this);
+       Accept(visitor);
+}
+
 bool
 _Control::IsInSizeRange(const Dimension& size) const
 {
@@ -2930,7 +2979,7 @@ _Control::SetBoundsFinal(const FloatRectangle& newBounds, bool changeLayoutBaseR
                }
        }
 
-       if ((moved || resized || !changeLayoutBaseRect) && callUpdateBoundsOfVisualElement)
+       if ((moved || resized) && callUpdateBoundsOfVisualElement)
        {
                const FloatRectangle fbounds(bounds.x, bounds.y, bounds.width, bounds.height);
                if (IsLayoutChangable() == false)
@@ -3467,6 +3516,8 @@ _Control::SetClientBounds(const Rectangle& bounds)
        __clientBounds = _CoordinateSystemUtils::ConvertToFloat(bounds);
        __isSetClientBounds = true;
 
+       AdjustAbsoluteBounds();
+
        SetUpdateLayoutState(true);
 
        return E_SUCCESS;
@@ -3483,6 +3534,8 @@ _Control::SetClientBounds(const FloatRectangle& bounds)
        __clientBounds = bounds;
        __isSetClientBounds = true;
 
+       AdjustAbsoluteBounds();
+
        SetUpdateLayoutState(true);
 
        return E_SUCCESS;
index 931e4fb..0a070d6 100644 (file)
@@ -544,6 +544,7 @@ private:
        result SetBoundsInternal(const Tizen::Graphics::FloatRectangle& bounds, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement = true);
        result SetBoundsFinal(const Tizen::Graphics::FloatRectangle& newBounds, bool changeLayoutBaseRect, bool callBoundsChangeCallbacks, bool callUpdateBoundsOfVisualElement = true);
        result UpdateBoundsOfVisualElement(const Tizen::Graphics::FloatRectangle& controlBounds);
+       result AdjustAbsoluteBounds(void);
 
        const ControlList& GetChildList(void) const;
        ControlList& GetChildList(void);