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

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

Issue 2533623002: Cleanup default FWL params part I (Closed)
Patch Set: Rebase to master 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
« no previous file with comments | « xfa/fwl/core/cfwl_widget.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_widgetmgr.h" 7 #include "xfa/fwl/core/cfwl_widgetmgr.h"
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 const CFX_RectF* pRect) { 177 const CFX_RectF* pRect) {
178 if (!m_pAdapter) 178 if (!m_pAdapter)
179 return; 179 return;
180 180
181 CFWL_Widget* pNative = pWidget; 181 CFWL_Widget* pNative = pWidget;
182 CFX_RectF rect(*pRect); 182 CFX_RectF rect(*pRect);
183 if (IsFormDisabled()) { 183 if (IsFormDisabled()) {
184 CFWL_Widget* pOuter = pWidget->GetOuter(); 184 CFWL_Widget* pOuter = pWidget->GetOuter();
185 while (pOuter) { 185 while (pOuter) {
186 CFX_RectF rtTemp; 186 CFX_RectF rtTemp;
187 pNative->GetWidgetRect(rtTemp); 187 pNative->GetWidgetRect(rtTemp, false);
188 rect.left += rtTemp.left; 188 rect.left += rtTemp.left;
189 rect.top += rtTemp.top; 189 rect.top += rtTemp.top;
190 pNative = pOuter; 190 pNative = pOuter;
191 pOuter = pOuter->GetOuter(); 191 pOuter = pOuter->GetOuter();
192 } 192 }
193 } else if (!IsAbleNative(pWidget)) { 193 } else if (!IsAbleNative(pWidget)) {
194 pNative = GetSystemFormWidget(pWidget); 194 pNative = GetSystemFormWidget(pWidget);
195 if (!pNative) 195 if (!pNative)
196 return; 196 return;
197 197
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) { 326 if ((child->GetStates() & FWL_WGTSTATE_Invisible) == 0) {
327 x1 = x; 327 x1 = x;
328 y1 = y; 328 y1 = y;
329 CFX_Matrix matrixOnParent; 329 CFX_Matrix matrixOnParent;
330 child->GetMatrix(matrixOnParent); 330 child->GetMatrix(matrixOnParent);
331 CFX_Matrix m; 331 CFX_Matrix m;
332 m.SetIdentity(); 332 m.SetIdentity();
333 m.SetReverse(matrixOnParent); 333 m.SetReverse(matrixOnParent);
334 m.TransformPoint(x1, y1); 334 m.TransformPoint(x1, y1);
335 CFX_RectF bounds; 335 CFX_RectF bounds;
336 child->GetWidgetRect(bounds); 336 child->GetWidgetRect(bounds, false);
337 if (bounds.Contains(x1, y1)) { 337 if (bounds.Contains(x1, y1)) {
338 x1 -= bounds.left; 338 x1 -= bounds.left;
339 y1 -= bounds.top; 339 y1 -= bounds.top;
340 return GetWidgetAtPoint(child, x1, y1); 340 return GetWidgetAtPoint(child, x1, y1);
341 } 341 }
342 } 342 }
343 child = GetPriorSiblingWidget(child); 343 child = GetPriorSiblingWidget(child);
344 } 344 }
345 return parent; 345 return parent;
346 } 346 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 496
497 void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget, 497 void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
498 CFX_Graphics* pGraphics, 498 CFX_Graphics* pGraphics,
499 const CFX_Matrix* pMatrix) { 499 const CFX_Matrix* pMatrix) {
500 if (!pWidget || !pGraphics) 500 if (!pWidget || !pGraphics)
501 return; 501 return;
502 502
503 CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); 503 CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix);
504 CFX_RectF clipCopy; 504 CFX_RectF clipCopy;
505 pWidget->GetWidgetRect(clipCopy); 505 pWidget->GetWidgetRect(clipCopy, false);
506 clipCopy.left = clipCopy.top = 0; 506 clipCopy.left = clipCopy.top = 0;
507 507
508 if (UseOffscreenDirect(pWidget)) { 508 if (UseOffscreenDirect(pWidget)) {
509 DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); 509 DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix);
510 return; 510 return;
511 } 511 }
512 CFX_RectF clipBounds; 512 CFX_RectF clipBounds;
513 513
514 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \ 514 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ || \
515 _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_ 515 _FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_ANDROID_
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 bool bFormDisable = IsFormDisabled(); 550 bool bFormDisable = IsFormDisabled();
551 CFWL_Widget* pNextChild = GetFirstChildWidget(parent); 551 CFWL_Widget* pNextChild = GetFirstChildWidget(parent);
552 while (pNextChild) { 552 while (pNextChild) {
553 CFWL_Widget* child = pNextChild; 553 CFWL_Widget* child = pNextChild;
554 pNextChild = GetNextSiblingWidget(child); 554 pNextChild = GetNextSiblingWidget(child);
555 if (child->GetStates() & FWL_WGTSTATE_Invisible) 555 if (child->GetStates() & FWL_WGTSTATE_Invisible)
556 continue; 556 continue;
557 557
558 CFX_RectF rtWidget; 558 CFX_RectF rtWidget;
559 child->GetWidgetRect(rtWidget); 559 child->GetWidgetRect(rtWidget, false);
560 if (rtWidget.IsEmpty()) 560 if (rtWidget.IsEmpty())
561 continue; 561 continue;
562 562
563 CFX_Matrix widgetMatrix; 563 CFX_Matrix widgetMatrix;
564 CFX_RectF clipBounds(rtWidget); 564 CFX_RectF clipBounds(rtWidget);
565 if (!bFormDisable) 565 if (!bFormDisable)
566 child->GetMatrix(widgetMatrix, true); 566 child->GetMatrix(widgetMatrix, true);
567 if (pMatrix) 567 if (pMatrix)
568 widgetMatrix.Concat(*pMatrix); 568 widgetMatrix.Concat(*pMatrix);
569 569
(...skipping 24 matching lines...) Expand all
594 CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget, 594 CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(CFWL_Widget* pWidget,
595 CFX_Graphics* pGraphics, 595 CFX_Graphics* pGraphics,
596 const CFX_Matrix* pMatrix) { 596 const CFX_Matrix* pMatrix) {
597 if (!FWL_UseOffscreen(pWidget)) 597 if (!FWL_UseOffscreen(pWidget))
598 return pGraphics; 598 return pGraphics;
599 599
600 Item* pItem = GetWidgetMgrItem(pWidget); 600 Item* pItem = GetWidgetMgrItem(pWidget);
601 if (!pItem->pOffscreen) { 601 if (!pItem->pOffscreen) {
602 pItem->pOffscreen.reset(new CFX_Graphics); 602 pItem->pOffscreen.reset(new CFX_Graphics);
603 CFX_RectF rect; 603 CFX_RectF rect;
604 pWidget->GetWidgetRect(rect); 604 pWidget->GetWidgetRect(rect, false);
605 pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height, 605 pItem->pOffscreen->Create((int32_t)rect.width, (int32_t)rect.height,
606 FXDIB_Argb); 606 FXDIB_Argb);
607 } 607 }
608 CFX_RectF rect; 608 CFX_RectF rect;
609 pGraphics->GetClipRect(rect); 609 pGraphics->GetClipRect(rect);
610 pItem->pOffscreen->SetClipRect(rect); 610 pItem->pOffscreen->SetClipRect(rect);
611 return pItem->pOffscreen.get(); 611 return pItem->pOffscreen.get();
612 } 612 }
613 613
614 void CFWL_WidgetMgr::DrawWidgetAfter(CFWL_Widget* pWidget, 614 void CFWL_WidgetMgr::DrawWidgetAfter(CFWL_Widget* pWidget,
(...skipping 15 matching lines...) Expand all
630 bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget, 630 bool CFWL_WidgetMgr::IsNeedRepaint(CFWL_Widget* pWidget,
631 CFX_Matrix* pMatrix, 631 CFX_Matrix* pMatrix,
632 const CFX_RectF& rtDirty) { 632 const CFX_RectF& rtDirty) {
633 Item* pItem = GetWidgetMgrItem(pWidget); 633 Item* pItem = GetWidgetMgrItem(pWidget);
634 if (pItem && pItem->iRedrawCounter > 0) { 634 if (pItem && pItem->iRedrawCounter > 0) {
635 pItem->iRedrawCounter = 0; 635 pItem->iRedrawCounter = 0;
636 return true; 636 return true;
637 } 637 }
638 638
639 CFX_RectF rtWidget; 639 CFX_RectF rtWidget;
640 pWidget->GetWidgetRect(rtWidget); 640 pWidget->GetWidgetRect(rtWidget, false);
641 rtWidget.left = rtWidget.top = 0; 641 rtWidget.left = rtWidget.top = 0;
642 pMatrix->TransformRect(rtWidget); 642 pMatrix->TransformRect(rtWidget);
643 if (!rtWidget.IntersectWith(rtDirty)) 643 if (!rtWidget.IntersectWith(rtDirty))
644 return false; 644 return false;
645 645
646 CFWL_Widget* pChild = 646 CFWL_Widget* pChild =
647 pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget); 647 pWidget->GetOwnerApp()->GetWidgetMgr()->GetFirstChildWidget(pWidget);
648 if (!pChild) 648 if (!pChild)
649 return true; 649 return true;
650 650
(...skipping 16 matching lines...) Expand all
667 rtWidget.width + rtWidget.left; 667 rtWidget.width + rtWidget.left;
668 hitPoint[0].hitPoint.y = hitPoint[1].hitPoint.y = rtWidget.top; 668 hitPoint[0].hitPoint.y = hitPoint[1].hitPoint.y = rtWidget.top;
669 hitPoint[2].hitPoint.y = hitPoint[3].hitPoint.y = hitPoint[4].hitPoint.y = 669 hitPoint[2].hitPoint.y = hitPoint[3].hitPoint.y = hitPoint[4].hitPoint.y =
670 hitPoint[5].hitPoint.y = fyPiece + rtWidget.top; 670 hitPoint[5].hitPoint.y = fyPiece + rtWidget.top;
671 hitPoint[6].hitPoint.y = hitPoint[7].hitPoint.y = hitPoint[8].hitPoint.y = 671 hitPoint[6].hitPoint.y = hitPoint[7].hitPoint.y = hitPoint[8].hitPoint.y =
672 hitPoint[9].hitPoint.y = fyPiece * 2 + rtWidget.top; 672 hitPoint[9].hitPoint.y = fyPiece * 2 + rtWidget.top;
673 hitPoint[10].hitPoint.y = hitPoint[11].hitPoint.y = 673 hitPoint[10].hitPoint.y = hitPoint[11].hitPoint.y =
674 rtWidget.height + rtWidget.top; 674 rtWidget.height + rtWidget.top;
675 do { 675 do {
676 CFX_RectF rect; 676 CFX_RectF rect;
677 pChild->GetWidgetRect(rect); 677 pChild->GetWidgetRect(rect, false);
678 CFX_RectF r = rect; 678 CFX_RectF r = rect;
679 r.left += rtWidget.left; 679 r.left += rtWidget.left;
680 r.top += rtWidget.top; 680 r.top += rtWidget.top;
681 if (r.IsEmpty()) 681 if (r.IsEmpty())
682 continue; 682 continue;
683 if (r.Contains(rtDirty)) 683 if (r.Contains(rtDirty))
684 return false; 684 return false;
685 if (!bChildIntersectWithDirty && r.IntersectWith(rtDirty)) 685 if (!bChildIntersectWithDirty && r.IntersectWith(rtDirty))
686 bChildIntersectWithDirty = true; 686 bChildIntersectWithDirty = true;
687 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild) 687 if (bOrginPtIntersectWidthDirty && !bOrginPtIntersectWidthChild)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 728 }
729 729
730 bool CFWL_WidgetMgr::UseOffscreenDirect(CFWL_Widget* pWidget) const { 730 bool CFWL_WidgetMgr::UseOffscreenDirect(CFWL_Widget* pWidget) const {
731 Item* pItem = GetWidgetMgrItem(pWidget); 731 Item* pItem = GetWidgetMgrItem(pWidget);
732 if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) 732 if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen))
733 return false; 733 return false;
734 734
735 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 735 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
736 if (pItem->bOutsideChanged) { 736 if (pItem->bOutsideChanged) {
737 CFX_RectF r; 737 CFX_RectF r;
738 pWidget->GetWidgetRect(r); 738 pWidget->GetWidgetRect(r, false);
739 CFX_RectF temp(m_rtScreen); 739 CFX_RectF temp(m_rtScreen);
740 temp.Deflate(50, 50); 740 temp.Deflate(50, 50);
741 if (!temp.Contains(r)) 741 if (!temp.Contains(r))
742 return false; 742 return false;
743 743
744 pItem->bOutsideChanged = false; 744 pItem->bOutsideChanged = false;
745 } 745 }
746 #endif 746 #endif
747 747
748 return pItem->iRedrawCounter == 0; 748 return pItem->iRedrawCounter == 0;
(...skipping 10 matching lines...) Expand all
759 pWidget(widget), 759 pWidget(widget),
760 iRedrawCounter(0) 760 iRedrawCounter(0)
761 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) 761 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_)
762 , 762 ,
763 bOutsideChanged(false) 763 bOutsideChanged(false)
764 #endif 764 #endif
765 { 765 {
766 } 766 }
767 767
768 CFWL_WidgetMgr::Item::~Item() {} 768 CFWL_WidgetMgr::Item::~Item() {}
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_widget.cpp ('k') | xfa/fxfa/app/xfa_ffbarcode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698