summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_csssyntaxparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde/css/cfde_csssyntaxparser.cpp')
-rw-r--r--xfa/fde/css/cfde_csssyntaxparser.cpp140
1 files changed, 0 insertions, 140 deletions
diff --git a/xfa/fde/css/cfde_csssyntaxparser.cpp b/xfa/fde/css/cfde_csssyntaxparser.cpp
index a24b4eee66..f562a374ac 100644
--- a/xfa/fde/css/cfde_csssyntaxparser.cpp
+++ b/xfa/fde/css/cfde_csssyntaxparser.cpp
@@ -19,20 +19,6 @@ bool IsSelectorStart(FX_WCHAR wch) {
(wch >= 'A' && wch <= 'Z');
}
-bool ParseCSSURI(const FX_WCHAR* pszValue, int32_t* iOffset, int32_t* iLength) {
- ASSERT(pszValue && *iLength > 0);
- if (*iLength < 6 || pszValue[*iLength - 1] != ')' ||
- FXSYS_wcsnicmp(L"url(", pszValue, 4)) {
- return false;
- }
- if (CFDE_CSSDeclaration::ParseCSSString(pszValue + 4, *iLength - 5, iOffset,
- iLength)) {
- *iOffset += 4;
- return true;
- }
- return false;
-}
-
} // namespace
CFDE_CSSSyntaxParser::CFDE_CSSSyntaxParser()
@@ -85,10 +71,6 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() {
switch (m_eMode) {
case FDE_CSSSyntaxMode::RuleSet:
switch (wch) {
- case '@':
- m_TextPlane.MoveNext();
- SwitchMode(FDE_CSSSyntaxMode::AtRule);
- break;
case '}':
m_TextPlane.MoveNext();
if (RestoreMode())
@@ -194,128 +176,6 @@ FDE_CSSSyntaxStatus CFDE_CSSSyntaxParser::DoSyntaxParse() {
}
m_TextPlane.MoveNext();
break;
- case FDE_CSSSyntaxMode::MediaType:
- switch (wch) {
- case ',':
- m_TextPlane.MoveNext();
- SwitchMode(FDE_CSSSyntaxMode::MediaType);
- if (m_iTextDatLen > 0)
- return FDE_CSSSyntaxStatus::MediaType;
- break;
- case '{': {
- if (m_ModeStack.empty() ||
- m_ModeStack.top() != FDE_CSSSyntaxMode::MediaRule) {
- m_eStatus = FDE_CSSSyntaxStatus::Error;
- return m_eStatus;
- }
-
- if (m_TextData.GetLength() > 0) {
- SaveTextData();
- return FDE_CSSSyntaxStatus::MediaType;
- }
- m_TextPlane.MoveNext();
-
- // Replace the MediaRule with a RuleSet rule.
- m_ModeStack.top() = FDE_CSSSyntaxMode::RuleSet;
-
- SwitchMode(FDE_CSSSyntaxMode::RuleSet);
- return FDE_CSSSyntaxStatus::DeclOpen;
- }
- case ';': {
- if (m_ModeStack.empty() ||
- m_ModeStack.top() != FDE_CSSSyntaxMode::Import) {
- m_eStatus = FDE_CSSSyntaxStatus::Error;
- return m_eStatus;
- }
-
- if (m_TextData.GetLength() > 0) {
- SaveTextData();
- if (IsImportEnabled())
- return FDE_CSSSyntaxStatus::MediaType;
- } else {
- bool bEnabled = IsImportEnabled();
- m_TextPlane.MoveNext();
- m_ModeStack.pop();
- SwitchMode(FDE_CSSSyntaxMode::RuleSet);
- if (bEnabled) {
- DisableImport();
- return FDE_CSSSyntaxStatus::ImportClose;
- }
- }
- } break;
- case '/':
- if (m_TextPlane.GetNextChar() == '*') {
- if (SwitchToComment() > 0)
- return FDE_CSSSyntaxStatus::MediaType;
- break;
- }
- default:
- AppendChar(wch);
- break;
- }
- break;
- case FDE_CSSSyntaxMode::URI: {
- if (m_ModeStack.empty() ||
- m_ModeStack.top() != FDE_CSSSyntaxMode::Import) {
- m_eStatus = FDE_CSSSyntaxStatus::Error;
- return m_eStatus;
- }
-
- if (wch <= ' ' || wch == ';') {
- int32_t iURIStart, iURILength = m_TextData.GetLength();
- if (iURILength > 0 &&
- ParseCSSURI(m_TextData.GetBuffer(), &iURIStart, &iURILength)) {
- m_TextData.Subtract(iURIStart, iURILength);
- SwitchMode(FDE_CSSSyntaxMode::MediaType);
- if (IsImportEnabled())
- return FDE_CSSSyntaxStatus::URI;
- break;
- }
- }
- AppendChar(wch);
- } break;
- case FDE_CSSSyntaxMode::AtRule:
- if (wch > ' ') {
- AppendChar(wch);
- } else {
- int32_t iLen = m_TextData.GetLength();
- const FX_WCHAR* psz = m_TextData.GetBuffer();
- if (FXSYS_wcsncmp(L"charset", psz, iLen) == 0) {
- SwitchMode(FDE_CSSSyntaxMode::Charset);
- } else if (FXSYS_wcsncmp(L"import", psz, iLen) == 0) {
- m_ModeStack.push(FDE_CSSSyntaxMode::Import);
- SwitchMode(FDE_CSSSyntaxMode::URI);
- if (IsImportEnabled())
- return FDE_CSSSyntaxStatus::ImportRule;
- break;
- } else if (FXSYS_wcsncmp(L"media", psz, iLen) == 0) {
- m_ModeStack.push(FDE_CSSSyntaxMode::MediaRule);
- SwitchMode(FDE_CSSSyntaxMode::MediaType);
- return FDE_CSSSyntaxStatus::MediaRule;
- } else if (FXSYS_wcsncmp(L"font-face", psz, iLen) == 0) {
- SwitchMode(FDE_CSSSyntaxMode::Selector);
- return FDE_CSSSyntaxStatus::FontFaceRule;
- } else if (FXSYS_wcsncmp(L"page", psz, iLen) == 0) {
- SwitchMode(FDE_CSSSyntaxMode::Selector);
- return FDE_CSSSyntaxStatus::PageRule;
- } else {
- SwitchMode(FDE_CSSSyntaxMode::UnknownRule);
- }
- }
- break;
- case FDE_CSSSyntaxMode::Charset:
- if (wch == ';') {
- m_TextPlane.MoveNext();
- SwitchMode(FDE_CSSSyntaxMode::RuleSet);
- if (IsCharsetEnabled()) {
- DisableCharset();
- if (m_iTextDatLen > 0)
- return FDE_CSSSyntaxStatus::Charset;
- }
- } else {
- AppendChar(wch);
- }
- break;
case FDE_CSSSyntaxMode::UnknownRule:
if (wch == ';')
SwitchMode(FDE_CSSSyntaxMode::RuleSet);