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

Side by Side Diff: xfa/fwl/core/cfwl_widget.cpp

Issue 2557103002: Cleanup FWL default values part II. (Closed)
Patch Set: Unused 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 unified diff | Download patch
OLDNEW
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/core/cfwl_widget.h" 7 #include "xfa/fwl/core/cfwl_widget.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (!bAutoSize) { 69 if (!bAutoSize) {
70 rect = m_pProperties->m_rtWidget; 70 rect = m_pProperties->m_rtWidget;
71 return; 71 return;
72 } 72 }
73 73
74 if (HasEdge()) { 74 if (HasEdge()) {
75 FX_FLOAT fEdge = GetEdgeWidth(); 75 FX_FLOAT fEdge = GetEdgeWidth();
76 rect.Inflate(fEdge, fEdge); 76 rect.Inflate(fEdge, fEdge);
77 } 77 }
78 if (HasBorder()) { 78 if (HasBorder()) {
79 FX_FLOAT fBorder = GetBorderSize(); 79 FX_FLOAT fBorder = GetBorderSize(true);
80 rect.Inflate(fBorder, fBorder); 80 rect.Inflate(fBorder, fBorder);
81 } 81 }
82 } 82 }
83 83
84 void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { 84 void CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
85 m_pProperties->m_rtWidget = rect; 85 m_pProperties->m_rtWidget = rect;
86 if (IsChild()) 86 if (IsChild())
87 return; 87 return;
88 88
89 m_pWidgetMgr->SetWidgetRect_Native(this, rect); 89 m_pWidgetMgr->SetWidgetRect_Native(this, rect);
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 310 }
311 311
312 bool CFWL_Widget::IsOffscreen() const { 312 bool CFWL_Widget::IsOffscreen() const {
313 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen); 313 return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen);
314 } 314 }
315 315
316 void CFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) { 316 void CFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) {
317 rtEdge = m_pProperties->m_rtWidget; 317 rtEdge = m_pProperties->m_rtWidget;
318 rtEdge.left = rtEdge.top = 0; 318 rtEdge.left = rtEdge.top = 0;
319 if (HasBorder()) { 319 if (HasBorder()) {
320 FX_FLOAT fCX = GetBorderSize(); 320 FX_FLOAT fCX = GetBorderSize(true);
321 FX_FLOAT fCY = GetBorderSize(false); 321 FX_FLOAT fCY = GetBorderSize(false);
322 rtEdge.Deflate(fCX, fCY); 322 rtEdge.Deflate(fCX, fCY);
323 } 323 }
324 } 324 }
325 325
326 FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) { 326 FX_FLOAT CFWL_Widget::GetBorderSize(bool bCX) {
327 FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity( 327 FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity(
328 bCX ? CFWL_WidgetCapacity::CXBorder : CFWL_WidgetCapacity::CYBorder)); 328 bCX ? CFWL_WidgetCapacity::CXBorder : CFWL_WidgetCapacity::CYBorder));
329 if (!pfBorder) 329 if (!pfBorder)
330 return 0; 330 return 0;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 if (!pRet) 392 if (!pRet)
393 return nullptr; 393 return nullptr;
394 394
395 while (CFWL_Widget* pOuter = pRet->GetOuter()) 395 while (CFWL_Widget* pOuter = pRet->GetOuter())
396 pRet = pOuter; 396 pRet = pOuter;
397 return pRet; 397 return pRet;
398 } 398 }
399 399
400 CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, 400 CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
401 IFWL_ThemeProvider* pTheme, 401 IFWL_ThemeProvider* pTheme,
402 bool bMultiLine, 402 bool bMultiLine) {
403 int32_t iLineWidth) {
404 if (!pTheme) 403 if (!pTheme)
405 return CFX_SizeF(); 404 return CFX_SizeF();
406 405
407 CFWL_ThemeText calPart; 406 CFWL_ThemeText calPart;
408 calPart.m_pWidget = this; 407 calPart.m_pWidget = this;
409 calPart.m_wsText = wsText; 408 calPart.m_wsText = wsText;
410 calPart.m_dwTTOStyles = 409 calPart.m_dwTTOStyles =
411 bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine; 410 bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine;
412 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft; 411 calPart.m_iTTOAlign = FDE_TTOALIGNMENT_TopLeft;
413 CFX_RectF rect; 412 CFX_RectF rect;
414 FX_FLOAT fWidth = bMultiLine 413 FX_FLOAT fWidth =
415 ? (iLineWidth > 0 ? (FX_FLOAT)iLineWidth 414 bMultiLine ? FWL_WGT_CalcMultiLineDefWidth : FWL_WGT_CalcWidth;
416 : FWL_WGT_CalcMultiLineDefWidth)
417 : FWL_WGT_CalcWidth;
418 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight); 415 rect.Set(0, 0, fWidth, FWL_WGT_CalcHeight);
419 pTheme->CalcTextRect(&calPart, rect); 416 pTheme->CalcTextRect(&calPart, rect);
420 return CFX_SizeF(rect.width, rect.height); 417 return CFX_SizeF(rect.width, rect.height);
421 } 418 }
422 419
423 void CFWL_Widget::CalcTextRect(const CFX_WideString& wsText, 420 void CFWL_Widget::CalcTextRect(const CFX_WideString& wsText,
424 IFWL_ThemeProvider* pTheme, 421 IFWL_ThemeProvider* pTheme,
425 uint32_t dwTTOStyles, 422 uint32_t dwTTOStyles,
426 int32_t iTTOAlign, 423 int32_t iTTOAlign,
427 CFX_RectF& rect) { 424 CFX_RectF& rect) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 719 }
723 default: 720 default:
724 break; 721 break;
725 } 722 }
726 } 723 }
727 724
728 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {} 725 void CFWL_Widget::OnProcessEvent(CFWL_Event* pEvent) {}
729 726
730 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics, 727 void CFWL_Widget::OnDrawWidget(CFX_Graphics* pGraphics,
731 const CFX_Matrix* pMatrix) {} 728 const CFX_Matrix* pMatrix) {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698