summaryrefslogtreecommitdiff
path: root/src/lib/edje/edje_calc.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-09 20:16:08 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-06-09 19:14:59 -0400
commit0392cd3c489ee1c69dc768b2c3e8ac01ba1854c1 (patch)
tree158ac8f87440980ce231dd6388d56977d5012d0f /src/lib/edje/edje_calc.c
parent9572e9189da786c79b1eb3c9a30fea680ece8aa5 (diff)
Revert "Edje calc: Fix textblock size calculation logic"
This reverts commit a6fff5bc1e5e30a946e435369bcbaa406dd5d5ba.
Diffstat (limited to 'src/lib/edje/edje_calc.c')
-rw-r--r--src/lib/edje/edje_calc.c305
1 files changed, 38 insertions, 267 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c
index 47e918cdcc..7a2e6a8d60 100644
--- a/src/lib/edje/edje_calc.c
+++ b/src/lib/edje/edje_calc.c
@@ -1476,17 +1476,9 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
1476 int *minw, int *minh, 1476 int *minw, int *minh,
1477 int *maxw, int *maxh) 1477 int *maxw, int *maxh)
1478{ 1478{
1479 int min_calc_w = 0, min_calc_h = 0;
1480
1481 if ((ep->type != EDJE_RP_TYPE_TEXT) || 1479 if ((ep->type != EDJE_RP_TYPE_TEXT) ||
1482 (!ep->typedata.text)) 1480 (!ep->typedata.text))
1483 return; 1481 return;
1484
1485 /* min_calc_* values need to save calculated minumum size
1486 * for maximum size calculation */
1487 if (minw) min_calc_w = *minw;
1488 if (minh) min_calc_h = *minh;
1489
1490 if (chosen_desc) 1482 if (chosen_desc)
1491 { 1483 {
1492 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; 1484 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
@@ -1631,277 +1623,56 @@ _edje_part_recalc_single_textblock(FLOAT_T sc,
1631 } 1623 }
1632 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y)) 1624 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y))
1633 { 1625 {
1634 evas_object_textblock_style_insets_get(ep->object, &ins_l, 1626 int mw = 0, mh = 0;
1635 &ins_r, &ins_t, &ins_b);
1636 1627
1637 tw = th = 0; 1628 tw = th = 0;
1638 if (!chosen_desc->text.min_x) 1629 if (!chosen_desc->text.min_x)
1639 { 1630 {
1640 /* text.min: 0 1 1631 efl_gfx_size_set(ep->object, TO_INT(params->eval.w), TO_INT(params->eval.h));
1641 * text.max: X X */ 1632 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1642 int temp_h = TO_INT(params->eval.h);
1643 int temp_w = TO_INT(params->eval.w);
1644
1645 if (min_calc_w > temp_w)
1646 temp_w = min_calc_w;
1647 if ((!chosen_desc->text.max_x) &&
1648 maxw && (*maxw > -1) && (*maxw < temp_w))
1649 temp_w = *maxw;
1650
1651 if (chosen_desc->text.max_y)
1652 {
1653 /* text.min: 0 1
1654 * text.max: X 1 */
1655 temp_h = INT_MAX / 10000;
1656 }
1657 else if (maxh && (*maxh > TO_INT(params->eval.h)))
1658 {
1659 /* text.min: 0 1
1660 * text.max: X 0
1661 * And there is a limit for height. */
1662 temp_h = *maxh;
1663 }
1664
1665 /* If base width for calculation is 0,
1666 * don't get meaningless height for multiline */
1667 if (temp_w > 0)
1668 {
1669 efl_gfx_size_set(ep->object, temp_w, temp_h);
1670 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1671
1672 tw += ins_l + ins_r;
1673 th += ins_t + ins_b;
1674 }
1675 else
1676 {
1677 efl_canvas_text_size_native_get(ep->object, NULL, &th);
1678
1679 th += ins_t + ins_b;
1680 }
1681 } 1633 }
1682 else 1634 else
1635 evas_object_textblock_size_native_get(ep->object, &tw, &th);
1636 evas_object_textblock_style_insets_get(ep->object, &ins_l,
1637 &ins_r, &ins_t, &ins_b);
1638 mw = ins_l + tw + ins_r;
1639 mh = ins_t + th + ins_b;
1640 if (minw && chosen_desc->text.min_x)
1683 { 1641 {
1684 /* text.min: 1 X 1642 if (mw > *minw) *minw = mw;
1685 * text.max: X X */
1686 if (chosen_desc->text.min_y && (!chosen_desc->text.max_x) &&
1687 maxw && (*maxw > -1))
1688 {
1689 /* text.min: 1 1
1690 * text.max: 0 X */
1691 int temp_w, temp_h;
1692
1693 temp_w = *maxw;
1694 temp_h = INT_MAX / 10000;
1695
1696 if (min_calc_w > temp_w)
1697 temp_w = min_calc_w;
1698
1699 if ((!chosen_desc->text.max_y) && maxh && (*maxh > -1))
1700 {
1701 /* text.min: 1 1
1702 * text.max: 0 0
1703 * There is limit for height. */
1704 temp_h = *maxh;
1705 }
1706
1707 efl_gfx_size_set(ep->object, temp_w, temp_h);
1708 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1709
1710 tw += ins_l + ins_r;
1711 th += ins_t + ins_b;
1712
1713 /* If base width for calculation is 0,
1714 * don't get meaningless height for multiline */
1715 if (temp_w <= 0)
1716 {
1717 efl_canvas_text_size_native_get(ep->object, NULL, &th);
1718
1719 th += ins_t + ins_b;
1720 }
1721 }
1722 else
1723 {
1724 /* text.min: 1 X
1725 * text.max: 1 X
1726 * Or,
1727 * text.min: 1 X
1728 * text.max: 0 X without max width.
1729 * It is a singleline Textblock. */
1730 efl_canvas_text_size_native_get(ep->object, &tw, &th);
1731
1732 tw += ins_l + ins_r;
1733 th += ins_t + ins_b;
1734
1735 if (!chosen_desc->text.max_x &&
1736 (maxw && (*maxw > -1) && (*maxw < tw)))
1737 {
1738 /* text.min: 1 0
1739 * text.max: 0 X */
1740 tw = *maxw;
1741 }
1742 }
1743 } 1643 }
1744 1644 if (minh && chosen_desc->text.min_y)
1745 if (tw > min_calc_w) min_calc_w = tw;
1746 if (th > min_calc_h) min_calc_h = th;
1747 if (chosen_desc->text.min_x && minw) *minw = min_calc_w;
1748 if (chosen_desc->text.min_y && minh) *minh = min_calc_h;
1749 }
1750
1751 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y))
1752 {
1753 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
1754 &ins_t, &ins_b);
1755
1756 tw = th = 0;
1757 if (!chosen_desc->text.max_x)
1758 { 1645 {
1759 /* text.min: X X 1646 if (mh > *minh) *minh = mh;
1760 * text.max: 0 1 */
1761 int temp_w, temp_h;
1762
1763 if (chosen_desc->text.min_y)
1764 {
1765 /* text.min: X 1
1766 * text.max: 0 1
1767 * Already calculated in text for height. */
1768 tw = TO_INT(params->eval.w);
1769 if (min_calc_w > tw)
1770 tw = min_calc_w;
1771
1772 th = min_calc_h;
1773 }
1774 else
1775 {
1776 /* text.min: X 0
1777 * text.max: 0 1 */
1778 temp_w = TO_INT(params->eval.w);
1779 temp_h = TO_INT(params->eval.h);
1780
1781 if (min_calc_w > temp_w)
1782 temp_w = min_calc_w;
1783 if (maxw && (*maxw > -1) && (*maxw < temp_w))
1784 temp_w = *maxw;
1785 if (min_calc_h > temp_h)
1786 temp_h = min_calc_h;
1787
1788 /* If base width for calculation is 0,
1789 * don't get meaningless height for multiline */
1790 if (temp_w > 0)
1791 {
1792 efl_gfx_size_set(ep->object, temp_w, temp_h);
1793 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1794
1795 tw += ins_l + ins_r;
1796 th += ins_t + ins_b;
1797 }
1798 else
1799 {
1800 efl_canvas_text_size_native_get(ep->object, NULL, &th);
1801
1802 th += ins_t + ins_b;
1803 }
1804 }
1805 } 1647 }
1806 else 1648 }
1807 { 1649 }
1808 /* text.max: 1 X */
1809 if (chosen_desc->text.min_x)
1810 {
1811 /* text.min: 1 X
1812 * text.max: 1 X
1813 * Singleline. */
1814 efl_canvas_text_size_native_get(ep->object, &tw, &th);
1815
1816 tw += ins_l + ins_r;
1817 th += ins_t + ins_b;
1818 }
1819 else
1820 {
1821 /* text.min: 0 X
1822 * text.max: 1 X */
1823 if (chosen_desc->text.max_y)
1824 {
1825 /* text.min: 0 X
1826 * text.max: 1 1 */
1827 int temp_w, temp_h;
1828
1829 temp_w = TO_INT(params->eval.w);
1830 temp_h = TO_INT(params->eval.h);
1831
1832 if (min_calc_w > temp_w)
1833 temp_w = min_calc_w;
1834 if (min_calc_h > temp_h)
1835 temp_h = min_calc_h;
1836
1837 if (chosen_desc->text.min_y)
1838 {
1839 /* text.min: 0 1
1840 * text.max: 1 1
1841 * There is no need to calculate it again. */
1842 tw = min_calc_w;
1843 th = min_calc_h;
1844 }
1845 else
1846 {
1847 /* text.min: 0 0
1848 * text.max: 1 1 */
1849
1850 efl_gfx_size_set(ep->object, temp_w, temp_h);
1851 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1852
1853 tw += ins_l + ins_r;
1854 th += ins_t + ins_b;
1855
1856 /* If base width for calculation is 0,
1857 * don't get meaningless height for multiline */
1858 if (temp_w <= 0)
1859 {
1860 efl_canvas_text_size_native_get(ep->object, NULL, &th);
1861
1862 th += ins_t + ins_b;
1863 }
1864 }
1865 }
1866 else
1867 {
1868 /* text.min: 0 X
1869 * text.max: 1 0 */
1870 int temp_w, temp_h;
1871
1872 temp_w = TO_INT(params->eval.w);
1873 if (min_calc_w > temp_w)
1874 temp_w = min_calc_w;
1875
1876 efl_gfx_size_get(ep->object, NULL, &temp_h);
1877 efl_gfx_size_set(ep->object, temp_w, temp_h);
1878 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1879
1880 tw += ins_l + ins_r;
1881 th += ins_t + ins_b;
1882
1883 /* If base width for calculation is 0,
1884 * don't get meaningless height for multiline */
1885 if (temp_w <= 0)
1886 {
1887 efl_canvas_text_size_native_get(ep->object, NULL, &th);
1888 1650
1889 th += ins_t + ins_b; 1651 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y))
1890 } 1652 {
1891 } 1653 int mw = 0, mh = 0;
1892 }
1893 }
1894 1654
1895 if (maxw && chosen_desc->text.max_x) 1655 tw = th = 0;
1896 { 1656 if (!chosen_desc->text.max_x)
1897 if (tw > *maxw) *maxw = tw; 1657 {
1898 if (minw && (*maxw < *minw)) *maxw = *minw; 1658 efl_gfx_size_set(ep->object, TO_INT(params->eval.w), TO_INT(params->eval.h));
1899 } 1659 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
1900 if (maxh && chosen_desc->text.max_y) 1660 }
1901 { 1661 else
1902 if (th > *maxh) *maxh = th; 1662 evas_object_textblock_size_native_get(ep->object, &tw, &th);
1903 if (minh && (*maxh < *minh)) *maxh = *minh; 1663 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
1904 } 1664 &ins_t, &ins_b);
1665 mw = ins_l + tw + ins_r;
1666 mh = ins_t + th + ins_b;
1667 if (maxw && chosen_desc->text.max_x)
1668 {
1669 if (mw > *maxw) *maxw = mw;
1670 if (minw && (*maxw < *minw)) *maxw = *minw;
1671 }
1672 if (maxh && chosen_desc->text.max_y)
1673 {
1674 if (mh > *maxh) *maxh = mh;
1675 if (minh && (*maxh < *minh)) *maxh = *minh;
1905 } 1676 }
1906 } 1677 }
1907 1678