summaryrefslogtreecommitdiff
path: root/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-23 13:54:53 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-23 19:48:54 +0000
commit6414b273506f97012f82c8a32c020b483d5df31a (patch)
treef790a25f03e78fe084ee22cb16418d95deaf3dd3 /xfa/fde/css/cfde_cssstylesheet_unittest.cpp
parenta0b2d23d1121202d3821291483943a47a3c9e32e (diff)
downloadpdfium-6414b273506f97012f82c8a32c020b483d5df31a.tar.xz
Cleanup CSS parsing
This Cl removes unused CSS parsing code. The only caller of CFDE_CSSStyleSheet::LoadeBuffer is from CXFA_TextParser which provides a static string. So, we know there are no Media rules, Import rules, FontFace rules or Page rules in the input style. These rules are also not allowed in inline styles. This CL removes the supporting code. Change-Id: I3a559352b2dd0769c465cbd3da40d1db5f9577b0 Reviewed-on: https://pdfium-review.googlesource.com/2330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/css/cfde_cssstylesheet_unittest.cpp')
-rw-r--r--xfa/fde/css/cfde_cssstylesheet_unittest.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
index 080b45aa1b..1c50f65607 100644
--- a/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
+++ b/xfa/fde/css/cfde_cssstylesheet_unittest.cpp
@@ -15,7 +15,6 @@
#include "xfa/fde/css/cfde_cssdeclaration.h"
#include "xfa/fde/css/cfde_cssenumvalue.h"
#include "xfa/fde/css/cfde_cssnumbervalue.h"
-#include "xfa/fde/css/cfde_cssrule.h"
#include "xfa/fde/css/cfde_cssstylerule.h"
#include "xfa/fde/css/cfde_cssvaluelist.h"
@@ -33,13 +32,10 @@ class CFDE_CSSStyleSheetTest : public testing::Test {
size_t decl_count) {
ASSERT(sheet_);
- EXPECT_TRUE(sheet_->LoadFromBuffer(buf, FXSYS_wcslen(buf)));
+ EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf)));
EXPECT_EQ(sheet_->CountRules(), 1);
- CFDE_CSSRule* rule = sheet_->GetRule(0);
- EXPECT_EQ(rule->GetType(), FDE_CSSRuleType::Style);
-
- CFDE_CSSStyleRule* style = static_cast<CFDE_CSSStyleRule*>(rule);
+ CFDE_CSSStyleRule* style = sheet_->GetRule(0);
EXPECT_EQ(selectors.size(), style->CountSelectorLists());
for (size_t i = 0; i < selectors.size(); i++) {
@@ -93,13 +89,10 @@ class CFDE_CSSStyleSheetTest : public testing::Test {
TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) {
const FX_WCHAR* buf =
L"a { border: 10px; }\nb { text-decoration: underline; }";
- EXPECT_TRUE(sheet_->LoadFromBuffer(buf, FXSYS_wcslen(buf)));
+ EXPECT_TRUE(sheet_->LoadBuffer(buf, FXSYS_wcslen(buf)));
EXPECT_EQ(2, sheet_->CountRules());
- CFDE_CSSRule* rule = sheet_->GetRule(0);
- EXPECT_EQ(FDE_CSSRuleType::Style, rule->GetType());
-
- CFDE_CSSStyleRule* style = static_cast<CFDE_CSSStyleRule*>(rule);
+ CFDE_CSSStyleRule* style = sheet_->GetRule(0);
EXPECT_EQ(1UL, style->CountSelectorLists());
bool found_selector = false;
@@ -123,10 +116,7 @@ TEST_F(CFDE_CSSStyleSheetTest, ParseMultipleSelectors) {
VerifyFloat(FDE_CSSProperty::BorderBottomWidth, 10.0,
FDE_CSSNumberType::Pixels);
- rule = sheet_->GetRule(1);
- EXPECT_EQ(FDE_CSSRuleType::Style, rule->GetType());
-
- style = static_cast<CFDE_CSSStyleRule*>(rule);
+ style = sheet_->GetRule(1);
EXPECT_EQ(1UL, style->CountSelectorLists());
found_selector = false;