| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 CSSTestHelper::~CSSTestHelper() | 42 CSSTestHelper::~CSSTestHelper() |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 CSSTestHelper::CSSTestHelper() | 46 CSSTestHelper::CSSTestHelper() |
| 47 { | 47 { |
| 48 m_document = Document::create(); | 48 m_document = Document::create(); |
| 49 TextPosition position; | 49 TextPosition position; |
| 50 m_styleSheet = CSSStyleSheet::createInline(m_document.get(), KURL(), positio
n, "UTF-8"); | 50 m_styleSheet = CSSStyleSheet::createInline(*m_document, KURL(), position, "U
TF-8"); |
| 51 } | 51 } |
| 52 | 52 |
| 53 CSSRuleList* CSSTestHelper::cssRules() | 53 CSSRuleList* CSSTestHelper::cssRules() |
| 54 { | 54 { |
| 55 return m_styleSheet->cssRules(); | 55 return m_styleSheet->cssRules(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 RuleSet& CSSTestHelper::ruleSet() | 58 RuleSet& CSSTestHelper::ruleSet() |
| 59 { | 59 { |
| 60 RuleSet& ruleSet = m_styleSheet->contents()->ensureRuleSet(MediaQueryEvaluat
or(), RuleHasNoSpecialState); | 60 RuleSet& ruleSet = m_styleSheet->contents()->ensureRuleSet(MediaQueryEvaluat
or(), RuleHasNoSpecialState); |
| 61 ruleSet.compactRulesIfNeeded(); | 61 ruleSet.compactRulesIfNeeded(); |
| 62 return ruleSet; | 62 return ruleSet; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void CSSTestHelper::addCSSRules(const char* cssText) | 65 void CSSTestHelper::addCSSRules(const char* cssText) |
| 66 { | 66 { |
| 67 TextPosition position; | 67 TextPosition position; |
| 68 unsigned sheetLength = m_styleSheet->length(); | 68 unsigned sheetLength = m_styleSheet->length(); |
| 69 m_styleSheet->contents()->parseStringAtPosition(cssText, position); | 69 m_styleSheet->contents()->parseStringAtPosition(cssText, position); |
| 70 ASSERT_TRUE(m_styleSheet->length() > sheetLength); | 70 ASSERT_TRUE(m_styleSheet->length() > sheetLength); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |