Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fwl/cfwl_widget.h" | 7 #include "xfa/fwl/cfwl_widget.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 fy += szOffset.y; | 188 fy += szOffset.y; |
| 189 return; | 189 return; |
| 190 } | 190 } |
| 191 CFX_RectF r; | 191 CFX_RectF r; |
| 192 CFX_Matrix m; | 192 CFX_Matrix m; |
| 193 CFWL_Widget* parent = GetParent(); | 193 CFWL_Widget* parent = GetParent(); |
| 194 if (parent) { | 194 if (parent) { |
| 195 r = GetWidgetRect(); | 195 r = GetWidgetRect(); |
| 196 fx += r.left; | 196 fx += r.left; |
| 197 fy += r.top; | 197 fy += r.top; |
| 198 GetMatrix(m, true); | 198 m = GetMatrix(); |
| 199 m.TransformPoint(fx, fy); | 199 m.TransformPoint(fx, fy); |
| 200 } | 200 } |
| 201 CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this); | 201 CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this); |
| 202 if (!form1) | 202 if (!form1) |
| 203 return; | 203 return; |
| 204 | 204 |
| 205 if (!pWidget) { | 205 if (!pWidget) { |
| 206 r = form1->GetWidgetRect(); | 206 r = form1->GetWidgetRect(); |
| 207 fx += r.left; | 207 fx += r.left; |
| 208 fy += r.top; | 208 fy += r.top; |
| 209 return; | 209 return; |
| 210 } | 210 } |
| 211 CFWL_Widget* form2 = m_pWidgetMgr->GetSystemFormWidget(pWidget); | 211 CFWL_Widget* form2 = m_pWidgetMgr->GetSystemFormWidget(pWidget); |
| 212 if (!form2) | 212 if (!form2) |
| 213 return; | 213 return; |
| 214 if (form1 != form2) { | 214 if (form1 != form2) { |
| 215 r = form1->GetWidgetRect(); | 215 r = form1->GetWidgetRect(); |
| 216 fx += r.left; | 216 fx += r.left; |
| 217 fy += r.top; | 217 fy += r.top; |
| 218 r = form2->GetWidgetRect(); | 218 r = form2->GetWidgetRect(); |
| 219 fx -= r.left; | 219 fx -= r.left; |
| 220 fy -= r.top; | 220 fy -= r.top; |
| 221 } | 221 } |
| 222 parent = pWidget->GetParent(); | 222 parent = pWidget->GetParent(); |
| 223 if (parent) { | 223 if (parent) { |
| 224 pWidget->GetMatrix(m, true); | |
| 225 CFX_Matrix m1; | 224 CFX_Matrix m1; |
| 226 m1.SetIdentity(); | 225 m1.SetReverse(pWidget->GetMatrix()); |
|
dsinclair
2016/12/08 19:02:46
CFX_Matrix constructor calls SetIdentity()
| |
| 227 m1.SetReverse(m); | |
| 228 m1.TransformPoint(fx, fy); | 226 m1.TransformPoint(fx, fy); |
| 229 r = pWidget->GetWidgetRect(); | 227 r = pWidget->GetWidgetRect(); |
| 230 fx -= r.left; | 228 fx -= r.left; |
| 231 fy -= r.top; | 229 fy -= r.top; |
| 232 } | 230 } |
| 233 } | 231 } |
| 234 | 232 |
| 235 void CFWL_Widget::GetMatrix(CFX_Matrix& matrix, bool bGlobal) { | 233 CFX_Matrix CFWL_Widget::GetMatrix() { |
| 236 if (!m_pProperties) | |
| 237 return; | |
| 238 if (!bGlobal) { | |
| 239 matrix.SetIdentity(); | |
| 240 return; | |
| 241 } | |
| 242 | |
| 243 CFWL_Widget* parent = GetParent(); | 234 CFWL_Widget* parent = GetParent(); |
| 244 CFX_ArrayTemplate<CFWL_Widget*> parents; | 235 CFX_ArrayTemplate<CFWL_Widget*> parents; |
| 245 while (parent) { | 236 while (parent) { |
| 246 parents.Add(parent); | 237 parents.Add(parent); |
| 247 parent = parent->GetParent(); | 238 parent = parent->GetParent(); |
| 248 } | 239 } |
| 249 matrix.SetIdentity(); | 240 |
| 241 CFX_Matrix matrix; | |
| 250 CFX_Matrix ctmOnParent; | 242 CFX_Matrix ctmOnParent; |
| 251 CFX_RectF rect; | 243 CFX_RectF rect; |
| 252 int32_t count = parents.GetSize(); | 244 int32_t count = parents.GetSize(); |
| 253 for (int32_t i = count - 2; i >= 0; i--) { | 245 for (int32_t i = count - 2; i >= 0; i--) { |
| 254 parent = parents.GetAt(i); | 246 parent = parents.GetAt(i); |
| 255 parent->GetMatrix(ctmOnParent, false); | 247 |
| 248 if (parent->m_pProperties) | |
| 249 ctmOnParent.SetIdentity(); | |
| 256 rect = parent->GetWidgetRect(); | 250 rect = parent->GetWidgetRect(); |
| 257 matrix.Concat(ctmOnParent, true); | 251 matrix.Concat(ctmOnParent, true); |
| 258 matrix.Translate(rect.left, rect.top, true); | 252 matrix.Translate(rect.left, rect.top, true); |
| 259 } | 253 } |
| 260 CFX_Matrix m; | 254 CFX_Matrix m; |
| 261 m.SetIdentity(); | 255 m.SetIdentity(); |
| 262 matrix.Concat(m, true); | 256 matrix.Concat(m, true); |
| 263 parents.RemoveAll(); | 257 parents.RemoveAll(); |
| 258 | |
| 259 return matrix; | |
| 264 } | 260 } |
| 265 | 261 |
| 266 IFWL_ThemeProvider* CFWL_Widget::GetThemeProvider() const { | 262 IFWL_ThemeProvider* CFWL_Widget::GetThemeProvider() const { |
| 267 return m_pProperties->m_pThemeProvider; | 263 return m_pProperties->m_pThemeProvider; |
| 268 } | 264 } |
| 269 | 265 |
| 270 void CFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { | 266 void CFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { |
| 271 m_pProperties->m_pThemeProvider = pThemeProvider; | 267 m_pProperties->m_pThemeProvider = pThemeProvider; |
| 272 } | 268 } |
| 273 | 269 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 707 } | 703 } |
| 708 default: | 704 default: |
| 709 break; | 705 break; |
| 710 } | 706 } |
| 711 } | 707 } |
| 712 | 708 |
| 713 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} | 709 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} |
| 714 | 710 |
| 715 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, | 711 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, |
| 716 const CFX_Matrix* pMatrix) {} | 712 const CFX_Matrix* pMatrix) {} |
| OLD | NEW |