Merge "fixed bug (TapGesture improvement)" into tizen_2.1
authorChulheon <ch.jeong47@samsung.com>
Thu, 2 May 2013 11:41:22 +0000 (20:41 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 2 May 2013 11:41:22 +0000 (20:41 +0900)
20 files changed:
src/graphics/FGrp_Canvas.cpp
src/graphics/FGrp_Font.cpp
src/graphics/inc/FGrp_TextTextCutLink.h
src/graphics/inc/FGrp_TextTextSimple.h
src/graphics/text/FGrp_TextTextComposite.cpp
src/graphics/text/FGrp_TextTextCutLink.cpp
src/ui/FUi_UiTouchEvent.cpp
src/ui/controls/FUiCtrl_DateTimeBarPresenter.cpp
src/ui/controls/FUiCtrl_Gallery.cpp
src/ui/controls/FUiCtrl_GalleryPresenter.cpp
src/ui/controls/FUiCtrl_IconListPresenter.cpp
src/ui/controls/FUiCtrl_TableViewPresenter.cpp
src/ui/inc/FUiCtrl_DateTimeBarPresenter.h
src/ui/inc/FUiCtrl_Gallery.h
src/ui/inc/FUiCtrl_GalleryPresenter.h
src/ui/inc/FUiCtrl_TableViewPresenter.h
src/ui/inc/FUi_LayoutLayout.h
src/ui/layout/FUi_LayoutLayout.cpp
src/ui/layout/FUi_LayoutRelativeLayout.cpp
src/ui/layout/FUi_LayoutTableLayout.cpp

index 8cd4ca5..b0793e0 100644 (file)
@@ -1320,7 +1320,7 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& rectD, const _Bitmap& bitmap
                const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo();
 
                {
-                       if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER)
+                       if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || bitmap.__isPremultiplied))
                        {
                                _Util::Pixmap srcImage(srcBufferInfo.width, srcBufferInfo.height, srcBufferInfo.bitsPerPixel, srcBufferInfo.pPixels, srcBufferInfo.pitch);
                                _ApplySrcBitmapAttrib(srcImage, bitmap, bitmap.__isOpaqueAllOver);
@@ -1488,7 +1488,7 @@ _Canvas::DrawBitmap(const _Util::Point<double>& pointD, const _Bitmap& bitmap)
                                _Util::Pixmap dstImageUnclipped(dstBufferInfo.width, dstBufferInfo.height, dstBufferInfo.bitsPerPixel, dstBufferInfo.pPixels, dstBufferInfo.pitch);
                                _Util::Pixmap dstImage = dstImageUnclipped.GetSubBitmap(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
 
-                               if (srcBufferInfo.pixelFormat == PIXEL_FORMAT_RGB565 && srcImage.enableColorKey == 0 && dstBufferInfo.pixelFormat == PIXEL_FORMAT_ARGB8888 && !this->__isClipBoundsSet)
+                               if (srcBufferInfo.pixelFormat == PIXEL_FORMAT_RGB565 && srcImage.enableColorKey == 0 && dstBufferInfo.pixelFormat == PIXEL_FORMAT_ARGB8888 && !this->__isClipBoundsSet && alphaConstant >= 255)
                                {
                                        pixman_image_t* pPixmanSrc = pixman_image_create_bits(PIXMAN_r5g6b5, srcBufferInfo.width, srcBufferInfo.height, (uint32_t*)srcBufferInfo.pPixels, srcBufferInfo.pitch);
                                        pixman_image_t* pPixmanDst = pixman_image_create_bits(PIXMAN_a8r8g8b8, dstBufferInfo.width, dstBufferInfo.height, (uint32_t*)dstBufferInfo.pPixels, dstBufferInfo.pitch);
@@ -1511,7 +1511,7 @@ _Canvas::DrawBitmap(const _Util::Point<double>& pointD, const _Bitmap& bitmap)
                                }
                        }
                        {
-                               bool isPixmanSupported = (!this->__useStableRenderer && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER);
+                               bool isPixmanSupported = (!this->__useStableRenderer && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || bitmap.__isPremultiplied));
 
                                if (isPixmanSupported)
                                {
@@ -1613,7 +1613,7 @@ _Canvas::DrawBitmap(const _Util::Rectangle<double>& destRectD, const _Bitmap& sr
                const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo();
 
                {
-                       if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER)
+                       if (!this->__useStableRenderer && srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied))
                        {
                                _Util::Rectangle<int> srcBounds =
                                {
@@ -1789,7 +1789,7 @@ _Canvas::DrawBitmapForNinePatchedBitmap(const Rectangle& destRect, const _Bitmap
                const BufferInfo& dstBufferInfo = dstLock.GetBufferInfo();
 
                {
-                       if (srcBufferInfo.bitsPerPixel == 32 && GetCompositeMode() != COMPOSITE_MODE_SRC_OVER)
+                       if (srcBufferInfo.bitsPerPixel == 32 && (GetCompositeMode() != COMPOSITE_MODE_SRC_OVER || srcBitmap.__isPremultiplied))
                        {
                                _Util::Rectangle<int> outRect = { 0, 0, -1, -1 };
                                _Util::Rectangle<int> dstRect = { destRect.x, destRect.y, destRect.width, destRect.height };
index 365984a..9dee62f 100644 (file)
@@ -1551,12 +1551,12 @@ _Font::__DrawText(_Canvas& canvas, const Point& point, const Tizen::Base::String
        wchar_t leftChar = 0;
        _IFont::Glyph* pFontGlyphData = 0;
 
+       _IFont::SizeProperty sizeProperty;
+       rtn = this->GetFontSizeProperty(sizeProperty);
+       SysTryReturn(NID_GRP, rtn, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to get font sizeProperty.");
+
        // need to revise y value, because _IFont is based on the baseline
        {
-               _IFont::SizeProperty sizeProperty;
-               bool rtn = this->GetFontSizeProperty(sizeProperty);
-               SysTryReturn(NID_GRP, rtn, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to get font sizeProperty.");
-
                if (canvas.__textOrigin == TEXT_ORIGIN_LEFT_TOP)
                {
                        yDest += sizeProperty.maxHeight.ToInt() + sizeProperty.descender.ToInt();
@@ -1754,8 +1754,6 @@ _Font::__DrawText(_Canvas& canvas, const Point& point, const Tizen::Base::String
                                yDest += pGlyph->yAdvance.ToInt();
                        }
 
-                       scratchPad.RegisterFillRect(null);
-
                        IEnumeratorT<_IFont::Glyph*>* pEnum = glyphList.GetEnumeratorN();
 
                        if (pEnum)
@@ -1898,29 +1896,39 @@ _Font::__DrawText(_Canvas& canvas, const Point& point, const Tizen::Base::String
                        pFont->UnloadGlyph(&pFontGlyphData);
 
                }
+       }
 
-               if (this->IsUnderlined() || this->IsStrikeOut())
-               {
-                       int y = point.y + charHeight - 1;
-                       int thick = this->GetLineThickness();
+       if (this->IsUnderlined() || this->IsStrikeOut())
+       {
+               int y = 0;
+               int thick = this->GetLineThickness();
 
-                       xDest -= this->GetCharSpace();
+               if (canvas.__textOrigin == TEXT_ORIGIN_LEFT_TOP)
+               {
+                       y = point.y + charHeight - 1;
+               }
+               else
+               {
+                       y = point.y - sizeProperty.descender.ToInt() - 1;
+               }
 
-                       if (this->IsUnderlined())
-                       {
-                               canvas.FillRectangle(canvasFgColor, Rectangle(startX, y - thick, xDest - startX, thick));
-                       }
+               xDest -= this->GetCharSpace();
 
-                       if (this->IsStrikeOut())
-                       {
-                               y -= charHeight / 2;
-                               canvas.FillRectangle(canvasFgColor, Rectangle(startX, y - thick, xDest - startX, thick));
-                       }
+               if (this->IsUnderlined())
+               {
+                       canvas.FillRectangle(canvasFgColor, Rectangle(startX, y - thick, xDest - startX, thick));
                }
 
-               scratchPad.RegisterFillRect(null);
+               if (this->IsStrikeOut())
+               {
+                       y -= charHeight / 2;
+                       canvas.FillRectangle(canvasFgColor, Rectangle(startX, y - thick, xDest - startX, thick));
+               }
        }
 
+       scratchPad.RegisterFillRect(null);
+
+
        return E_SUCCESS;
 }
 
@@ -2005,7 +2013,7 @@ _Font::__UpdateFontAttribute(int style, _Util::FixedPoint26_6 pcSize)
 {
        __fontAttrib.style = style;
        __fontAttrib.size = pcSize;
-       __fontAttrib.lineThickness = ((pcSize < 24) ? 1 : ((pcSize < 48) ? 2 : 3));
+       __fontAttrib.lineThickness = pcSize.ToInt() > 0 ? (pcSize.ToInt() / 24) + 1 : 1;
 
        _IFont::SizeProperty sizeProperty;
        bool getProperty = false;
index fe2c434..f753750 100644 (file)
@@ -64,6 +64,8 @@ public:
 
        virtual result SetTextOffset(int offset);
 
+       virtual const Font* GetFont(void) const;
+
        bool GetEditable(void) const;
 
        void SetEditModeEnable(bool enable);
index 979b863..ad96fbd 100644 (file)
@@ -95,7 +95,7 @@ public:
 
        result SetFont(const Font* pFont);
 
-       const Font* GetFont(void) const;
+       virtual const Font* GetFont(void) const;
 
        virtual void SetForegroundColor(const Color& color);
 
index a69a9bc..0ce0e53 100644 (file)
@@ -640,7 +640,7 @@ TextComposite::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int st
                TextElement* pLastTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : GetElementAtTextIndex(startTextIndex + textLength - 1);
                SysTryCatch(NID_GRP, pLastTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
 
-               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT || pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
                {
                        TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastTextElement);
                        SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
@@ -874,7 +874,7 @@ TextComposite::DrawWithEliipsis(_CanvasImpl& canvasImpl, FloatRectangle& display
                pLastDisplayTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : GetElementAtTextIndex(startTextIndex + textLength - 1);
                SysTryCatch(NID_GRP, pLastDisplayTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
 
-               if (pLastDisplayTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               if (pLastDisplayTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT || pLastDisplayTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
                {
                        TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastDisplayTextElement);
                        SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
@@ -1212,7 +1212,7 @@ TextComposite::DrawWithBaseline(_CanvasImpl& canvasImpl, FloatRectangle& display
                TextElement* pLastTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1);
                SysTryCatch(NID_GRP, pLastTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
 
-               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT || pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
                {
                        TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastTextElement);
                        SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
@@ -1417,6 +1417,7 @@ TextComposite::DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectan
                        {
                                GetRegion(textIndexFromElementOffset, 1, spaceCharDim.width, spaceCharDim.height);
                                textLength--;
+                               currentLength--;\r
                                startTextIndex++;
                                textIndexFromElementOffset++;
                        }
@@ -1426,10 +1427,10 @@ TextComposite::DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectan
        GetRegion(startTextIndex, textLength, textSize.width, textSize.height);
        if (action == TEXT_OBJECT_ACTION_TYPE_ABBREV)
        {
-               TextElement* pLastTextElement = GetElementAtTextIndex(startTextIndex + textLength - 1);
+               TextElement* pLastTextElement = (textLength == 0) ? GetElementAtTextIndex(startTextIndex) : GetElementAtTextIndex(startTextIndex + textLength - 1);
                SysTryCatch(NID_GRP, pLastTextElement, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
 
-               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+               if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT || pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
                {
                        TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastTextElement);
                        SysTryCatch(NID_GRP, pSimpleText, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
@@ -1442,7 +1443,7 @@ TextComposite::DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectan
                        , TEXT_OBJECT_WRAP_TYPE_CHARACTER, textLength, textSize.width, textSize.height);
 
                textSize.width += abbrevTextDim.width;
-               currentLength = textLength;
+               currentLength = Math::Min(currentLength, textLength);
                drawAbbrevText = true;
        }
 
@@ -1475,6 +1476,7 @@ TextComposite::DrawWithBaselineWithEllipsis(_CanvasImpl& canvasImpl, FloatRectan
                SysTryCatch(NID_GRP, r == E_SUCCESS, , r, "[%s] Fail to move next element.", GetErrorMessage(r));
        }
 
+       currentLength = Math::Min(textLength, currentLength);
        blockRect = FloatRectangle(adjustedRect.x, displayRect.y, adjustedRect.width, adjustedRect.height);
        adjustedRect.y = displayRect.y + displayRect.height - baseline;
        canvasImpl.SetTextOrigin(TEXT_ORIGIN_BASELINE);
@@ -5775,7 +5777,7 @@ TextComposite::GetDisplayableText(FloatRectangle displayRect, TextObjectActionTy
                        TextElement* pLastTextElement = GetElementAtTextIndex(lineOffset + lineLength - 1);
                        SysTryReturn(NID_GRP, pLastTextElement, -1, E_SYSTEM, "[E_SYSTEM] Fail to get element.");
 
-                       if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT)
+                       if (pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_TEXT || pLastTextElement->GetType() == TEXT_ELEMENT_TYPE_CUTLINK)
                        {
                                TextSimple* pSimpleText = dynamic_cast < TextSimple* >(pLastTextElement);
                                SysTryReturn(NID_GRP, pSimpleText, String(L""), E_SYSTEM, "[E_SYSTEM] Fail to cast text element.");
index 64071a6..64b5cf3 100644 (file)
@@ -232,6 +232,17 @@ TextCutLink::ChangeTextOffset(wchar_t* pText, int gap)
        return TextSimple::ChangeTextOffset(pText, gap);
 }
 
+const Font*
+TextCutLink::GetFont(void) const
+{
+       if (__isEdited)
+       {
+               return TextSimple::GetCurrentFont();
+       }
+
+       return __pLinkFont;
+}
+
 Font*
 TextCutLink::GetCurrentFont(void) const
 {
index 4577e67..3ec30d0 100644 (file)
@@ -209,9 +209,12 @@ _UiTouchEvent::IsEventEnabled(const _Control& control) const
                return false;
        }
 
-       if (!control.IsInputEventEnabled())
+       if (GetTouchInfo()->GetTouchStatus() != _TOUCH_CANCELED)
        {
-               return false;
+               if (!control.IsInputEventEnabled())
+               {
+                       return false;
+               }
        }
 
        return true;
index daee0e7..1cbc67b 100644 (file)
@@ -1343,7 +1343,7 @@ _DateTimeBarPresenter::OnFlickGestureDetected(int distanceX,int distanceY,int du
        int velY = 0;
 
        __flickAnimation.CalculateInitializeVelocity(distanceX, 0, duration, &velX, &velY);
-       __flickAnimation.InitializeFlickAmount(velX);
+       __flickAnimation.InitializeFlickAmount(velX * FLICK_ANIMATION_VELOCITY_FACTOR_DATE_TIME_BAR);
 
        StartFlickAnimationTimer();
        return true;
index 56befc0..3e175a9 100644 (file)
@@ -16,6 +16,7 @@
 //
 #include <FBaseString.h>
 #include <FGrpColor.h>
+#include <FSys_SettingInfoImpl.h>
 #include "FUi_AccessibilityContainer.h"
 #include "FUi_AccessibilityElement.h"
 #include "FUi_AccessibilityManager.h"
@@ -36,6 +37,7 @@
 
 using namespace Tizen::Base;
 using namespace Tizen::Graphics;
+using namespace Tizen::System;
 using namespace Tizen::Ui::Effects;
 
 namespace Tizen { namespace Ui { namespace Controls {
@@ -111,6 +113,13 @@ _Gallery::~_Gallery(void)
                SysAssert(false);
        }
 
+       r = _SettingInfoImpl::RemoveSettingEventListenerForInternal(*this);
+       if (r != E_SUCCESS)
+       {
+               SetLastResult(r);
+               SysAssert(false);
+       }
+
        RemoveGalleryAccessibilityElements();
 
        delete __pRenderer;
@@ -186,6 +195,9 @@ _Gallery::Construct(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor
        r = __pinchGesture.AddGestureListener(*this);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
+       r = _SettingInfoImpl::AddSettingEventListenerForInternal(*this);
+       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
        SetRenderer((_GalleryRenderer &)*pRenderer);
        SetPresenter((_GalleryPresenter &)*pPresenter);
 
@@ -621,4 +633,14 @@ _Gallery::AddGalleryAccessibilityElement(void)
        return;
 }
 
+void
+_Gallery::OnSettingChanged(Tizen::Base::String& key)
+{
+       const wchar_t* LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
+       if (key == LOCALE_LANGUAGE)
+       {
+               __pPresenter->UpdateEmptyString();
+       }
+}
+
 }}} // Tizen::Ui::Controls
index fa6e024..4596f61 100644 (file)
@@ -83,6 +83,7 @@ _GalleryPresenter::_GalleryPresenter(_IGalleryRenderer& galleryRenderer)
        , __horizontalAlignment(GALLERY_HORIZONTAL_ALIGN_CENTER)
        , __emptyFontSize(0)
        , __emptyFontStyle(FONT_STYLE_PLAIN)
+       , __userSetEmptyText(false)
        , __pGalleryView(null)
 {
        AddPropertyChangeEventListener(*this);
@@ -394,6 +395,7 @@ _GalleryPresenter::GetTextOfEmptyGallery(void) const
 result
 _GalleryPresenter::SetTextOfEmptyGallery(const String& text)
 {
+       __userSetEmptyText = true;
        result r = __galleryRenderer.SetEmptyText(text);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
@@ -1315,4 +1317,24 @@ _GalleryPresenter::OnFontChanged(void)
        }
 }
 
+void
+_GalleryPresenter::UpdateEmptyString(void)
+{
+       if (__userSetEmptyText == false)
+       {
+               GET_STRING_CONFIG(IDS_COM_BODY_NO_IMAGES, __emptyText);
+               result r = __galleryRenderer.SetEmptyText(__emptyText);
+               SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               if (GetItemCount() == 0)
+               {
+                       r = __galleryRenderer.EnableEmptyView();
+                       SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+
+               r = __galleryRenderer.RefreshView();
+               SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+}
+
 }}} // Tizen::Ui::Controls
index a735ef4..cb9fb21 100644 (file)
@@ -1462,6 +1462,8 @@ _IconListPresenter::AddGroupAndRestoreItem(bool restoreItem)
        {
                __pListModel->RestoreItemStatus();
        }
+
+       return E_SUCCESS;
 }
 
 result
index d027de3..c16d5a5 100644 (file)
@@ -72,12 +72,16 @@ _TableViewPresenter::_TableViewPresenter()
        , __isAnimationCallbackBlocked(false)
        , __lockLoadItemWithScroll(false)
        , __itemTouchReleasedEventState(TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_NORMAL)
+       , __scrollToItemTag()
 {
        __sweptItemTag.itemIndex = -1;
        __sweptItemTag.groupIndex = -1;
 
        __reservedScrollItemIndex.itemIndex = -1;
        __reservedScrollItemIndex.groupIndex = -1;
+
+       __expandableItemTag.groupIndex = -1;
+       __expandableItemTag.itemIndex = -1;
 }
 
 _TableViewPresenter::~_TableViewPresenter()
@@ -1649,14 +1653,7 @@ _TableViewPresenter::SetItemDrawingProperty(void)
                        __pItemDrawingProperty->propertyChanged = true;
                }
 
-               if (__pTableView->GetScrollStyle() == TABLE_VIEW_SCROLL_BAR_STYLE_FAST_SCROLL)
-               {
-                       GET_SHAPE_CONFIG(TABLEVIEW::FASTSCROLL_INDEX_WIDTH, _CONTROL_ORIENTATION_PORTRAIT, __pItemDrawingProperty->scrollMargin);
-               }
-               else
-               {
-                       __pItemDrawingProperty->scrollMargin = 0;
-               }
+               __pItemDrawingProperty->scrollMargin = 0;
 
                if (!_FloatCompare(__pItemDrawingProperty->width, __pTableView->GetBoundsF().width))
                {
@@ -2477,6 +2474,8 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
 
        __pListModel->SetGroupExpandState(groupIndex, true);
 
+       ResetSweepItem();
+
        float groupTotalHeight = 0.0f;
        int itemCount = GetItemCountAt(groupIndex);
        _TableViewItem* pItem = null;
@@ -2490,27 +2489,37 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
 
        if (groupIndex < topTag.groupIndex || groupIndex > bottomTag.groupIndex)
        {
-               int firstLoadedGroupIndex = -1;
-               int firstLoadedItemIndex = -1;
-               __pListModel->GetFirstLoadedItemIndex(firstLoadedGroupIndex, firstLoadedItemIndex);
-
-               TableViewItemTag firstLoadedItemTag = {firstLoadedGroupIndex, firstLoadedItemIndex};
-               _TableViewItem* pItem = FindItem(firstLoadedItemTag);
+               _TableViewItem* pItem = FindItem(topTag);
                if (pItem != null)
                {
-                       float itemPositionY = CalculateItemPositionY(firstLoadedItemTag.groupIndex, firstLoadedItemTag.itemIndex);
-
                        FloatRectangle itemBounds = pItem->GetBoundsF();
-                       itemBounds.y = itemPositionY;
+                       itemBounds.y = CalculateItemPositionY(topTag.groupIndex, topTag.itemIndex);
                        pItem->SetBounds(itemBounds);
-
-                       AttachNextItemsToBottom(firstLoadedItemTag);
+                       AttachNextItemsToBottom(topTag);
                        if (groupIndex < topTag.groupIndex)
                        {
-                               _ScrollPanelPresenter::ScrollTo(screenPosition + groupTotalHeight);
+                               ScrollTo(screenPosition + groupTotalHeight);
                        }
                }
 
+               int firstLoadedGroupIndex = -1;
+               int firstLoadedItemIndex = -1;
+               __pListModel->GetFirstLoadedItemIndex(firstLoadedGroupIndex, firstLoadedItemIndex);
+
+               for (int j = firstLoadedGroupIndex; j <= topTag.groupIndex; j++)
+               {
+                       int itemCount = GetItemCountAt(j);
+
+                       for (int i = -1; i < itemCount; i++)
+                       {
+                               if (i >= topTag.itemIndex && j == topTag.groupIndex)
+                               {
+                                       break;
+                               }
+
+                               UnloadItem(j, i);
+                       }
+               }
                return E_SUCCESS;
        }
 
@@ -2533,7 +2542,7 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
                float startPosition = itemBounds.y + itemBounds.height;
 
                float endPosition = startPosition + groupTotalHeight;
-               if (!_FloatCompareLE(endPosition, screenPosition + __pTableView->GetBoundsF().height))
+               if (endPosition > screenPosition + __pTableView->GetBoundsF().height)
                {
                        endPosition = screenPosition + __pTableView->GetBoundsF().height;
                }
@@ -2608,16 +2617,13 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                _TableViewItem* pItem = FindItem(firstLoadedItemTag);
                if (pItem != null)
                {
-                       float itemPositionY = CalculateItemPositionY(firstLoadedItemTag.groupIndex, firstLoadedItemTag.itemIndex);
-
                        FloatRectangle itemBounds = pItem->GetBoundsF();
-                       itemBounds.y = itemPositionY;
+                       itemBounds.y = CalculateItemPositionY(firstLoadedItemTag.groupIndex, firstLoadedItemTag.itemIndex);
                        pItem->SetBounds(itemBounds);
-
                        AttachNextItemsToBottom(firstLoadedItemTag);
                        if (groupIndex < itemTag.groupIndex)
                        {
-                               _ScrollPanelPresenter::ScrollTo(screenPosition - groupTotalHeight);
+                               ScrollTo(screenPosition - groupTotalHeight);
                        }
                }
 
@@ -2681,7 +2687,7 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                        endPosition += itemBounds.height;
                }
 
-               if (!_FloatCompareLE(endPosition, screenPosition + __pTableView->GetBoundsF().height))
+               if (endPosition > screenPosition + __pTableView->GetBoundsF().height)
                {
                        endPosition = screenPosition + __pTableView->GetBoundsF().height;
                }
@@ -2700,8 +2706,6 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                CollapseGroupAnimationFinished(false);
        }
 
-       AdjustClientAreaBounds(false, -groupTotalHeight);
-
        return E_SUCCESS;
 }
 
@@ -3134,6 +3138,33 @@ _TableViewPresenter::LoadItemWithScrollPosition(float previousScrollPosition, fl
 void
 _TableViewPresenter::ScrollToItem(int groupIndex, int itemIndex, TableViewScrollItemAlignment itemAlignment, float shiftingDistance)
 {
+       _VisualElement* pVisualElement = __pTableView->GetVisualElement();
+       String animationName(L"EXPAND_GROUP_ANIMATION");
+       VisualElementValueAnimation* pExpandGroupAnimation = dynamic_cast<VisualElementValueAnimation*>(pVisualElement->GetAnimationN(animationName));
+       if (pExpandGroupAnimation != null)
+       {
+               __scrollToItemTag.groupIndex = groupIndex;
+               __scrollToItemTag.itemIndex = itemIndex;
+               __scrollToItemTag.itemAlignment = itemAlignment;
+               __scrollToItemTag.shiftingDistance = shiftingDistance;
+               __scrollToItemTag.startedAnimation = true;
+               delete pExpandGroupAnimation;
+               return;
+       }
+
+       animationName = L"COLLAPSE_GROUP_ANIMATION";
+       VisualElementValueAnimation* pCollapseGroupAnimation = dynamic_cast<VisualElementValueAnimation*>(pVisualElement->GetAnimationN(animationName));
+       if (pCollapseGroupAnimation != null)
+       {
+               __scrollToItemTag.groupIndex = groupIndex;
+               __scrollToItemTag.itemIndex = itemIndex;
+               __scrollToItemTag.itemAlignment = itemAlignment;
+               __scrollToItemTag.shiftingDistance = shiftingDistance;
+               __scrollToItemTag.startedAnimation = true;
+               delete pCollapseGroupAnimation;
+               return;
+       }
+
        TableViewItemTag itemPos = {groupIndex, itemIndex};
 
        StopAllItemAnimation();
@@ -4691,22 +4722,25 @@ _TableViewPresenter::SetLoadedItemsVisibleFromPosition(float position, bool visi
                if (visible)
                {
                        pItem = LoadItem(current.groupIndex, current.itemIndex);
+                       if (pItem == null)
+                       {
+                               break;
+                       }
                }
                else
                {
                        pItem = FindItem(current);
-               }
-
-               if (pItem == null)
-               {
-                       break;
+                       if (pItem == null)
+                       {
+                               continue;
+                       }
                }
 
                itemBounds = pItem->GetBoundsF();
 
                if (visible)
                {
-                       if (_FloatCompareGE(position, itemBounds.y) && !_FloatCompareGE(position, itemBounds.y + itemBounds.height))
+                       if ((position >= itemBounds.y) && (position < itemBounds.y + itemBounds.height))
                        {
                                ShowTableViewCapturedItem(current.groupIndex, current.itemIndex, position - itemBounds.y);
                                pItem->SetVisibleState(false);
@@ -4719,11 +4753,11 @@ _TableViewPresenter::SetLoadedItemsVisibleFromPosition(float position, bool visi
                }
                else
                {
-                       if (!_FloatCompareGE(position, itemBounds.y))
+                       if (position < itemBounds.y)
                        {
                                UnloadItem(current);
                        }
-                       else if (_FloatCompareGE(position, itemBounds.y) && !_FloatCompareGE(position, itemBounds.y + itemBounds.height))
+                       else if ((position >= itemBounds.y) && (position < itemBounds.y + itemBounds.height))
                        {
                                pItem->SetVisibleState(false);
                                ShowTableViewCapturedItem(current.groupIndex, current.itemIndex, position - itemBounds.y);
@@ -4805,7 +4839,7 @@ _TableViewPresenter::ExpandGroupAnimationFinished(bool completedNormally)
 
                while (GetNextItemPosition(current, next))
                {
-                       if (_FloatCompareGE(screenPosition, nextItemPositionY))
+                       if (screenPosition >= nextItemPositionY)
                        {
                                pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
                                if (pCurrentItem == null)
@@ -4872,6 +4906,8 @@ _TableViewPresenter::ExpandGroupAnimationFinished(bool completedNormally)
 void
 _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
 {
+       int itemCountInGroup = __pListModel->GetItemCountInGroup(__expandableItemTag.groupIndex);
+
        if (completedNormally == false)
        {
                TableViewItemTag current;
@@ -4880,15 +4916,12 @@ _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
                current.groupIndex = __expandableItemTag.groupIndex;
                current.itemIndex = -1;
 
-               _TableViewItem* pCurrentItem = null;
-               int itemCountInGroup = __pListModel->GetItemCountInGroup(__expandableItemTag.groupIndex);
-
                for (int i = 0; i < itemCountInGroup; i++)
                {
                        UnloadItem(__expandableItemTag.groupIndex, i);
                }
 
-               pCurrentItem = FindItem(current);
+               _TableViewItem* pCurrentItem = FindItem(current);
                if (pCurrentItem == null)
                {
                        SysTryReturnVoidResult(NID_UI_CTRL, pCurrentItem != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.")
@@ -4903,7 +4936,7 @@ _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
                while (GetNextItemPosition(current, next))
                {
                        current = next;
-                       if (_FloatCompareGE(screenPosition, nextItemPositionY))
+                       if (screenPosition >= nextItemPositionY)
                        {
                                pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
                                if (pCurrentItem == null)
@@ -4915,7 +4948,6 @@ _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
                                itemBounds = pCurrentItem->GetBoundsF();
                                itemBounds.y = nextItemPositionY;
                                pCurrentItem->SetBounds(itemBounds);
-
                                nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
                        }
                        else
@@ -4926,20 +4958,6 @@ _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
        }
        else
        {
-               float scrollPosition = GetScrollPosition();
-
-               int groupItemsHeight = 0;
-               _TableViewItem* pItem = null;
-               for (int i = 0; i < __expandableItemTag.itemIndex; i++)
-               {
-                       pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i));
-                       groupItemsHeight += pItem->GetItemHeight();
-               }
-
-               _TableViewItem* pTableViewItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, __expandableItemTag.itemIndex));
-               FloatRectangle itemBounds = pTableViewItem->GetBoundsF();
-               groupItemsHeight += (scrollPosition - itemBounds.y);
-
                int currentGroupIndex = -1;
                int currentItemIndex = -1;
                GetTopDrawnItemIndex(currentGroupIndex, currentItemIndex);
@@ -4963,12 +4981,39 @@ _TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
                        }
                }
 
-               int itemCount = GetItemCountAt(__expandableItemTag.groupIndex);
-               for (int i = 0; i < itemCount; i++)
+               for (int i = 0; i < itemCountInGroup; i++)
                {
                        UnloadItem(__expandableItemTag.groupIndex, i);
                }
+
+               GetTopDrawnItemIndex(currentGroupIndex, currentItemIndex);
+               TableViewItemTag currentItemTag;
+               currentItemTag.groupIndex = currentGroupIndex;
+               currentItemTag.itemIndex = currentItemIndex;
+
+               _TableViewItem* pItem = FindItem(currentItemTag);
+               if (pItem != null)
+               {
+                       FloatRectangle itemBounds = pItem->GetBoundsF();
+                       itemBounds.y = CalculateItemPositionY(currentGroupIndex, currentItemIndex);
+                       pItem->SetBounds(itemBounds);
+                       AttachNextItemsToBottom(currentItemTag);
+                       if (__expandableItemTag.groupIndex < currentGroupIndex)
+                       {
+                               SetScrollPosition(itemBounds.y, false);
+                       }
+               }
+       }
+
+       float groupTotalHeight = 0;
+       _TableViewItem* pItem = null;
+       for (int i = 0; i < itemCountInGroup; i++)
+       {
+               pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i));
+               groupTotalHeight += pItem->GetItemHeight();
        }
+
+       AdjustClientAreaBounds(false, -groupTotalHeight);
 }
 
 void
@@ -5021,8 +5066,13 @@ _TableViewPresenter::OnVisualElementAnimationFinished(const Tizen::Ui::Animation
                {
                        __pCapturedItemVisualElement->SetShowState(false);
                }
-
                ExpandGroupAnimationFinished(completedNormally);
+
+               if (__scrollToItemTag.startedAnimation)
+               {
+                       __scrollToItemTag.startedAnimation = false;
+                       ScrollToItem(__scrollToItemTag.groupIndex, __scrollToItemTag.itemIndex, __scrollToItemTag.itemAlignment, __scrollToItemTag.shiftingDistance);
+               }
                return;
        }
        else if (keyName == L"COLLAPSE_GROUP_ANIMATION")
@@ -5031,8 +5081,13 @@ _TableViewPresenter::OnVisualElementAnimationFinished(const Tizen::Ui::Animation
                {
                        __pCapturedItemVisualElement->SetShowState(false);
                }
-
                CollapseGroupAnimationFinished(completedNormally);
+
+               if (__scrollToItemTag.startedAnimation)
+               {
+                       __scrollToItemTag.startedAnimation = false;
+                       ScrollToItem(__scrollToItemTag.groupIndex, __scrollToItemTag.itemIndex, __scrollToItemTag.itemAlignment, __scrollToItemTag.shiftingDistance);
+               }
                return;
        }
 
@@ -5108,6 +5163,12 @@ _TableViewPresenter::OnAccessibilityItemRefreshed(const _AccessibilityContainer&
        else if (direction == _ACCESSIBILITY_FOCUS_DIRECTION_PREVIOUS)
        {
                GetLastItem(itemPos);
+
+               if (IsGroupExpanded(itemPos.groupIndex) == false)
+               {
+                       itemPos.itemIndex = -1;
+               }
+
                if (GetAccessibilityElementFocusedState() == false && FindItem(itemPos) == null)
                {
                        ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
index 7cbc100..bd2a378 100644 (file)
@@ -147,6 +147,7 @@ private:
        static const int FLICK_ANIMATION_TIMER_PERIOD = 10;
        static const int FLICK_ANIMATION_FPS_DATE_TIME_BAR = 30;
        static const int FLICK_ANIMATION_SENSITIVITY_DATE_TIME_BAR = 30;
+       static const int FLICK_ANIMATION_VELOCITY_FACTOR_DATE_TIME_BAR = 3;
 
        Tizen::Graphics::FloatRectangle __bodyAreaBounds;
        Tizen::Graphics::FloatRectangle __arrowAreaBounds;
index e335fc7..6b358e6 100644 (file)
@@ -18,6 +18,7 @@
 #define _FUI_CTRL_INTERNAL_GALLERY_H_
 
 
+#include <FSysISettingEventListener.h>
 #include "FUi_Control.h"
 #include "FUi_ITouchFlickGestureEventListener.h"
 #include "FUi_ITouchTapGestureEventListener.h"
@@ -67,6 +68,7 @@ class _Gallery
        , virtual public Tizen::Ui::_ITouchGestureEventListener
        , virtual public Tizen::Ui::_IUiEventPreviewer
        , virtual public Tizen::Base::Runtime::IEventListener
+       , virtual public Tizen::System::ISettingEventListener
 {
 public:
        virtual ~_Gallery(void);
@@ -131,6 +133,8 @@ public:
 
        void ResizeGalleryAccessibilityElement(void);
 
+       virtual void OnSettingChanged(Tizen::Base::String& key);
+
 private:
        _Gallery(void);
        result Construct(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor);
index 6ee9e38..11b1f23 100644 (file)
@@ -144,6 +144,8 @@ public:
 
        virtual void OnFontInfoRequested(unsigned long& style, int& size);
 
+       void UpdateEmptyString(void);
+
 protected:
        _GalleryPresenter(_IGalleryRenderer& galleryRenderer);
        result Construct(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor, _Gallery* pGalleryView);
@@ -201,6 +203,7 @@ private:
 
        int __emptyFontSize;
        Tizen::Graphics::FontStyle __emptyFontStyle;
+       bool __userSetEmptyText;
 
        _Gallery* __pGalleryView;
 
index cd1041e..752ad1d 100644 (file)
@@ -68,7 +68,6 @@ struct _TableViewReorderInfo
        long long touchPressedTick;
        Tizen::Graphics::FloatRectangle itemBounds;
 
-
        _TableViewReorderInfo(void)
                : groupIndex(-1)
                , itemIndex(-1)
@@ -102,6 +101,24 @@ struct _TableViewSectionStringAlignment
        bool operator!= (const _TableViewSectionStringAlignment& rhs) const;
 };
 
+struct _TableViewScrollToItemTag
+{
+       int groupIndex;
+       int itemIndex;
+       TableViewScrollItemAlignment itemAlignment;
+       float shiftingDistance;
+       bool startedAnimation;
+
+       _TableViewScrollToItemTag(void)
+               : groupIndex(-1)
+               , itemIndex(-1)
+               , itemAlignment(TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP)
+               , shiftingDistance(0)
+               , startedAnimation(false)
+       {
+
+       }
+};
 
 class _TableView;
 class _ListViewModel;
@@ -401,6 +418,8 @@ private:
 
        int __itemTouchReleasedEventState;
 
+       _TableViewScrollToItemTag __scrollToItemTag;
+
        static const int TABLEVIEW_MAX_ITEM_COUNT = 30;
        static const int REORDER_SCROLL_ANIMATION_TIMER_DURATION = 10;
        static const float REORDER_SCROLL_ANIMATION_DISTANCE = 10.0f;
index 8f6c7be..1b52f4a 100644 (file)
@@ -312,6 +312,10 @@ protected:
        void SetItemList(ProxyList* pItemList);
        ProxyList* GetProxyList(void) const;
 
+       void AlignToDevice(const LayoutPoint layoutPoint, LayoutPoint& alignedPoint);
+       void AlignToDevice(const LayoutSize layoutSize, LayoutSize& alignedSize);
+       void AlignToDevice(const LayoutRect layoutRect, LayoutRect& alignedRect);
+
 private:
        /**
         * This is the copy constructor for this class.
index 2d18b16..92d6b39 100644 (file)
  */
 
 #include <FBaseSysLog.h>
+#include <FGrpCoordinateSystem.h>
+#include <FGrpFloatRectangle.h>
+#include <FGrpFloatDimension.h>
+#include <FGrpFloatPoint.h>
 #include "FUi_LayoutLayout.h"
 #include "FUi_LayoutLayoutItemProxy.h"
 #include "FUi_LayoutProxyList.h"
 #include "FUi_LayoutLayoutItemInfo.h"
 #include "FUi_LayoutLayoutList.h"
 
+using namespace Tizen::Graphics;
+
 namespace Tizen { namespace Ui { namespace _Layout
 {
 
@@ -901,4 +907,36 @@ Layout::GetProxyList(void) const
        return __pProxyList;
 }
 
+void
+Layout::AlignToDevice(const LayoutPoint layoutPoint, LayoutPoint& alignedPoint)
+{
+       FloatPoint point(layoutPoint.x, layoutPoint.y);
+       point = CoordinateSystem::AlignToDevice(point);
+
+       alignedPoint.x = point.x;
+       alignedPoint.y = point.y;
+}
+
+void
+Layout::AlignToDevice(const LayoutSize layoutSize, LayoutSize& alignedSize)
+{
+       FloatDimension size(layoutSize.w, layoutSize.h);
+       size = CoordinateSystem::AlignToDevice(size);
+
+       alignedSize.w = size.width;
+       alignedSize.h = size.height;
+}
+
+void
+Layout::AlignToDevice(const LayoutRect layoutRect, LayoutRect& alignedRect)
+{
+       FloatRectangle rect(layoutRect.x, layoutRect.y, layoutRect.w, layoutRect.h);
+       rect = CoordinateSystem::AlignToDevice(rect);
+
+       alignedRect.x = rect.x;
+       alignedRect.y = rect.y;
+       alignedRect.w = rect.width;
+       alignedRect.h = rect.height;
+}
+
 }}} // Tizen::Ui::_Layout
index 104dae0..5262342 100644 (file)
@@ -556,6 +556,7 @@ RelativeLayout::CalculatePosition(ProxyListNode& curNode)
                {
                        return r;
                }
+               AlignToDevice(curItemRect, curItemRect);
                curItemRect.x = targetPosition.x + curItemMargin.left;
        }
 
@@ -566,6 +567,7 @@ RelativeLayout::CalculatePosition(ProxyListNode& curNode)
                {
                        return r;
                }
+               AlignToDevice(curItemRect, curItemRect);
                curItemRect.y = targetPosition.y + curItemMargin.top;
        }
 
@@ -577,6 +579,7 @@ RelativeLayout::CalculatePosition(ProxyListNode& curNode)
                        return r;
                }
 
+               AlignToDevice(curItemRect, curItemRect);
                if (pCurItemInfo->__pTarget[EDGE_LEFT] != null)
                {
                        curItemRect.w = targetPosition.x - curItemRect.x - curItemMargin.right;
@@ -592,6 +595,7 @@ RelativeLayout::CalculatePosition(ProxyListNode& curNode)
                        return r;
                }
 
+               AlignToDevice(curItemRect, curItemRect);
                if (pCurItemInfo->__pTarget[EDGE_TOP] != null)
                {
                        curItemRect.h = targetPosition.y - curItemRect.y - curItemMargin.bottom;
index cf49a92..84e3bca 100644 (file)
@@ -182,22 +182,14 @@ TableLayout::CalculateSize()
                                pItemProxy->GetMeasuredSize(rect.w, rect.h);
 
                                ItemMargin margin = pItemProxy->GetItemMargin();
-                               ItemAlign itemAlign = pItemProxy->GetItemAlignment();
-                               if (itemAlign.HAlign == ITEM_HORIZONTAL_ALIGN_LEFT || itemAlign.HAlign == ITEM_HORIZONTAL_ALIGN_LEFT_RIGHT)
+                               if (!__pColInfo[j].widthStretchable && !__pColInfo[j].widthShrinkable)
                                {
-                                       rect.w += margin.left;
+                                       rect.w += margin.left + margin.right;
                                }
-                               if (itemAlign.HAlign == ITEM_HORIZONTAL_ALIGN_RIGHT || itemAlign.HAlign == ITEM_HORIZONTAL_ALIGN_LEFT_RIGHT)
-                               {
-                                       rect.w += margin.right;
-                               }
-                               if (itemAlign.VAlign == ITEM_VERTICAL_ALIGN_TOP || itemAlign.VAlign == ITEM_VERTICAL_ALIGN_TOP_BOTTOM)
-                               {
-                                       rect.h += margin.top;
-                               }
-                               if (itemAlign.VAlign == ITEM_VERTICAL_ALIGN_BOTTOM || itemAlign.VAlign == ITEM_VERTICAL_ALIGN_TOP_BOTTOM)
+
+                               if (!__pRowInfo[i].heightStretchable && !__pRowInfo[i].heightShrinkable)
                                {
-                                       rect.h += margin.bottom;
+                                       rect.h += margin.top + margin.bottom;
                                }
 
                                if (!pItemInfo->__merged)
@@ -389,7 +381,7 @@ TableLayout::CalculateShrinkCell(const LayoutRect windowRect)
        ProxyListNode* pCurNode = null;
        TableItemInfo* pItemInfo = null;
 
-       if (shrinkTotalWidth > 0 && __shrinkColumnCount > 0)
+       if (shrinkTotalWidth >= 0.0f && __shrinkColumnCount > 0)
        {
                if (pContainerProxy->GetItemWidthMatchMode() == WRAP_CONTENT)
                {
@@ -553,7 +545,7 @@ TableLayout::CalculateShrinkCell(const LayoutRect windowRect)
                delete[] pShrinkedColumns;
        }
 
-       if (shrinkTotalHeight > 0.0f && __shrinkRowCount > 0)
+       if (shrinkTotalHeight >= 0.0f && __shrinkRowCount > 0)
        {
                if (pContainerProxy->GetItemHeightMatchMode() == WRAP_CONTENT)
                {
@@ -749,7 +741,7 @@ TableLayout::CalculateStretchCell(const LayoutRect windowRect)
        ProxyListNode* pCurNode = null;
        TableItemInfo* pItemInfo = null;
 
-       if (stretchTotalWidth > 0 && __stretchColumnCount > 0)
+       if (stretchTotalWidth >= 0.0f && __stretchColumnCount > 0)
        {
                if (pContainerProxy->GetItemWidthMatchMode() == WRAP_CONTENT)
                {
@@ -894,7 +886,7 @@ TableLayout::CalculateStretchCell(const LayoutRect windowRect)
                delete[] pStretchedColumns;
        }
 
-       if (stretchTotalHeight > 0 && __stretchRowCount > 0)
+       if (stretchTotalHeight >= 0.0f && __stretchRowCount > 0)
        {
                if (pContainerProxy->GetItemHeightMatchMode() == WRAP_CONTENT)
                {