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

Side by Side Diff: xfa/fxfa/app/xfa_textlayout.cpp

Issue 1876253002: Cleaning up FDE_CSS Classes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months 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/fde/css/fde_cssstyleselector.cpp ('k') | no next file » | 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/fxfa/app/xfa_textlayout.h" 7 #include "xfa/fxfa/app/xfa_textlayout.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "core/fxcrt/include/fx_ext.h" 11 #include "core/fxcrt/include/fx_ext.h"
12 #include "xfa/fde/css/fde_csscache.h"
12 #include "xfa/fde/fde_pen.h" 13 #include "xfa/fde/fde_pen.h"
13 #include "xfa/fde/xml/fde_xml_imp.h" 14 #include "xfa/fde/xml/fde_xml_imp.h"
14 #include "xfa/fgas/crt/fgas_algorithm.h" 15 #include "xfa/fgas/crt/fgas_algorithm.h"
15 #include "xfa/fgas/crt/fgas_codepage.h" 16 #include "xfa/fgas/crt/fgas_codepage.h"
16 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" 17 #include "xfa/fxfa/app/xfa_ffwidgetacc.h"
17 #include "xfa/fxfa/include/xfa_ffapp.h" 18 #include "xfa/fxfa/include/xfa_ffapp.h"
18 #include "xfa/fxfa/include/xfa_ffdoc.h" 19 #include "xfa/fxfa/include/xfa_ffdoc.h"
19 #include "xfa/fxfa/include/xfa_fontmgr.h" 20 #include "xfa/fxfa/include/xfa_fontmgr.h"
20 21
21 CXFA_CSSTagProvider::~CXFA_CSSTagProvider() { 22 CXFA_CSSTagProvider::~CXFA_CSSTagProvider() {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 m_mapXMLNodeToParseContext.GetValueAt(pXMLNode)); 219 m_mapXMLNodeToParseContext.GetValueAt(pXMLNode));
219 if (!pContext) 220 if (!pContext)
220 return nullptr; 221 return nullptr;
221 pContext->m_pParentStyle = pParentStyle; 222 pContext->m_pParentStyle = pParentStyle;
222 pParentStyle->AddRef(); 223 pParentStyle->AddRef();
223 CXFA_CSSTagProvider tagProvider; 224 CXFA_CSSTagProvider tagProvider;
224 ParseTagInfo(pXMLNode, tagProvider); 225 ParseTagInfo(pXMLNode, tagProvider);
225 if (tagProvider.m_bContent) 226 if (tagProvider.m_bContent)
226 return nullptr; 227 return nullptr;
227 IFDE_CSSComputedStyle* pStyle = CreateStyle(pParentStyle); 228 IFDE_CSSComputedStyle* pStyle = CreateStyle(pParentStyle);
228 IFDE_CSSAccelerator* pCSSAccel = m_pSelector->InitAccelerator(); 229 CFDE_CSSAccelerator* pCSSAccel = m_pSelector->InitAccelerator();
229 pCSSAccel->OnEnterTag(&tagProvider); 230 pCSSAccel->OnEnterTag(&tagProvider);
230 m_pSelector->ComputeStyle(&tagProvider, pContext->GetDecls(), 231 m_pSelector->ComputeStyle(&tagProvider, pContext->GetDecls(),
231 pContext->CountDecls(), pStyle); 232 pContext->CountDecls(), pStyle);
232 pCSSAccel->OnLeaveTag(&tagProvider); 233 pCSSAccel->OnLeaveTag(&tagProvider);
233 return pStyle; 234 return pStyle;
234 } 235 }
235 void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer, 236 void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer,
236 CXFA_TextProvider* pTextProvider) { 237 CXFA_TextProvider* pTextProvider) {
237 if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) { 238 if (pXMLContainer == NULL || pTextProvider == NULL || m_pAllocator) {
238 return; 239 return;
(...skipping 16 matching lines...) Expand all
255 return; 256 return;
256 } 257 }
257 IFDE_CSSComputedStyle* pNewStyle = NULL; 258 IFDE_CSSComputedStyle* pNewStyle = NULL;
258 if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) || 259 if ((tagProvider.GetTagName() != FX_WSTRC(L"body")) ||
259 (tagProvider.GetTagName() != FX_WSTRC(L"html"))) { 260 (tagProvider.GetTagName() != FX_WSTRC(L"html"))) {
260 CXFA_TextParseContext* pTextContext = 261 CXFA_TextParseContext* pTextContext =
261 FXTARGET_NewWith(m_pAllocator) CXFA_TextParseContext; 262 FXTARGET_NewWith(m_pAllocator) CXFA_TextParseContext;
262 FDE_CSSDISPLAY eDisplay = FDE_CSSDISPLAY_Inline; 263 FDE_CSSDISPLAY eDisplay = FDE_CSSDISPLAY_Inline;
263 if (!tagProvider.m_bContent) { 264 if (!tagProvider.m_bContent) {
264 pNewStyle = CreateStyle(pParentStyle); 265 pNewStyle = CreateStyle(pParentStyle);
265 IFDE_CSSAccelerator* pCSSAccel = m_pSelector->InitAccelerator(); 266 CFDE_CSSAccelerator* pCSSAccel = m_pSelector->InitAccelerator();
266 pCSSAccel->OnEnterTag(&tagProvider); 267 pCSSAccel->OnEnterTag(&tagProvider);
267 CFDE_CSSDeclarationArray DeclArray; 268 CFDE_CSSDeclarationArray DeclArray;
268 int32_t iMatchedDecls = 269 int32_t iMatchedDecls =
269 m_pSelector->MatchDeclarations(&tagProvider, DeclArray); 270 m_pSelector->MatchDeclarations(&tagProvider, DeclArray);
270 const IFDE_CSSDeclaration** ppMatchDecls = 271 const IFDE_CSSDeclaration** ppMatchDecls =
271 (const IFDE_CSSDeclaration**)DeclArray.GetData(); 272 (const IFDE_CSSDeclaration**)DeclArray.GetData();
272 m_pSelector->ComputeStyle(&tagProvider, ppMatchDecls, iMatchedDecls, 273 m_pSelector->ComputeStyle(&tagProvider, ppMatchDecls, iMatchedDecls,
273 pNewStyle); 274 pNewStyle);
274 pCSSAccel->OnLeaveTag(&tagProvider); 275 pCSSAccel->OnLeaveTag(&tagProvider);
275 if (iMatchedDecls > 0) { 276 if (iMatchedDecls > 0) {
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 tr.iLength = iLength; 1992 tr.iLength = iLength;
1992 tr.fFontSize = pPiece->fFontSize; 1993 tr.fFontSize = pPiece->fFontSize;
1993 tr.iBidiLevel = pPiece->iBidiLevel; 1994 tr.iBidiLevel = pPiece->iBidiLevel;
1994 tr.iCharRotation = 0; 1995 tr.iCharRotation = 0;
1995 tr.wLineBreakChar = L'\n'; 1996 tr.wLineBreakChar = L'\n';
1996 tr.iVerticalScale = pPiece->iVerScale; 1997 tr.iVerticalScale = pPiece->iVerScale;
1997 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; 1998 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab;
1998 tr.iHorizontalScale = pPiece->iHorScale; 1999 tr.iHorizontalScale = pPiece->iHorScale;
1999 return TRUE; 2000 return TRUE;
2000 } 2001 }
OLDNEW
« no previous file with comments | « xfa/fde/css/fde_cssstyleselector.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698