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

Unified Diff: xfa/fwl/core/cfwl_widget.cpp

Issue 2556873004: Convert GetWidgetRect to return rect. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_widget.h ('k') | xfa/fwl/core/cfwl_widgetmgr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/cfwl_widget.cpp
diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp
index 80ff57ce13dc9d0915849570aa9411fe86450cfc..3f30817def2df40b7ca308ac4aa447cc8bc2fefb 100644
--- a/xfa/fwl/core/cfwl_widget.cpp
+++ b/xfa/fwl/core/cfwl_widget.cpp
@@ -65,12 +65,13 @@ bool CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
return false;
}
-void CFWL_Widget::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
- if (!bAutoSize) {
- rect = m_pProperties->m_rtWidget;
- return;
- }
+CFX_RectF CFWL_Widget::GetWidgetRect(bool bAutoSize) {
+ if (!bAutoSize)
+ return m_pProperties->m_rtWidget;
+
+ CFX_RectF rect;
InflateWidgetRect(rect);
+ return rect;
}
void CFWL_Widget::InflateWidgetRect(CFX_RectF& rect) {
@@ -201,7 +202,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
CFX_Matrix m;
CFWL_Widget* parent = GetParent();
if (parent) {
- GetWidgetRect(r, false);
+ InflateWidgetRect(r);
fx += r.left;
fy += r.top;
GetMatrix(m, true);
@@ -210,8 +211,9 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this);
if (!form1)
return;
+
if (!pWidget) {
- form1->GetWidgetRect(r, false);
+ r = form1->GetWidgetRect(false);
fx += r.left;
fy += r.top;
return;
@@ -220,10 +222,10 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
if (!form2)
return;
if (form1 != form2) {
- form1->GetWidgetRect(r, false);
+ r = form1->GetWidgetRect(false);
fx += r.left;
fy += r.top;
- form2->GetWidgetRect(r, false);
+ r = form2->GetWidgetRect(false);
fx -= r.left;
fy -= r.top;
}
@@ -234,7 +236,7 @@ void CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
m1.SetIdentity();
m1.SetReverse(m);
m1.TransformPoint(fx, fy);
- pWidget->GetWidgetRect(r, false);
dsinclair 2016/12/07 21:09:11 If pWidget isn't a subclass that overrides GetWidg
+ r = pWidget->GetWidgetRect(false);
fx -= r.left;
fy -= r.top;
}
@@ -261,7 +263,7 @@ void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) {
for (int32_t i = count - 2; i >= 0; i--) {
parent = parents.GetAt(i);
parent->GetMatrix(ctmOnParent, false);
- parent->GetWidgetRect(rect, false);
dsinclair 2016/12/07 21:09:11 potential difference if parent is a subclass that
+ rect = parent->GetWidgetRect(false);
matrix.Concat(ctmOnParent, true);
matrix.Translate(rect.left, rect.top, true);
}
@@ -686,8 +688,7 @@ CFX_SizeF CFWL_Widget::GetOffsetFromParent(CFWL_Widget* pParent) {
CFWL_Widget* pDstWidget = GetParent();
while (pDstWidget && pDstWidget != pParent) {
- CFX_RectF rtDst;
- pDstWidget->GetWidgetRect(rtDst, false);
+ CFX_RectF rtDst = pDstWidget->GetWidgetRect(false);
szRet += CFX_SizeF(rtDst.left, rtDst.top);
pDstWidget = pWidgetMgr->GetParentWidget(pDstWidget);
}
« no previous file with comments | « xfa/fwl/core/cfwl_widget.h ('k') | xfa/fwl/core/cfwl_widgetmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698