OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 2 * Copyright (C) 2012-2013 Intel Corporation. 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 : m_document(document), | 43 : m_document(document), |
44 m_hasAuthorStyle(false) | 44 m_hasAuthorStyle(false) |
45 { | 45 { |
46 ASSERT(m_document); | 46 ASSERT(m_document); |
47 } | 47 } |
48 | 48 |
49 ViewportStyleResolver::~ViewportStyleResolver() | 49 ViewportStyleResolver::~ViewportStyleResolver() |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule) | 53 void ViewportStyleResolver::collectViewportRules(RuleSet* rules, Origin origin) |
| 54 { |
| 55 rules->compactRulesIfNeeded(); |
| 56 |
| 57 const Vector<StyleRuleViewport*>& viewportRules = rules->viewportRules(); |
| 58 for (size_t i = 0; i < viewportRules.size(); ++i) |
| 59 addViewportRule(viewportRules[i], origin); |
| 60 } |
| 61 |
| 62 void ViewportStyleResolver::addViewportRule(StyleRuleViewport* viewportRule, Ori
gin origin) |
54 { | 63 { |
55 StylePropertySet* propertySet = viewportRule->mutableProperties(); | 64 StylePropertySet* propertySet = viewportRule->mutableProperties(); |
56 | 65 |
57 unsigned propertyCount = propertySet->propertyCount(); | 66 unsigned propertyCount = propertySet->propertyCount(); |
58 if (!propertyCount) | 67 if (!propertyCount) |
59 return; | 68 return; |
60 | 69 |
| 70 if (origin == AuthorOrigin) |
| 71 m_hasAuthorStyle = true; |
| 72 |
61 if (!m_propertySet) { | 73 if (!m_propertySet) { |
62 m_propertySet = propertySet->mutableCopy(); | 74 m_propertySet = propertySet->mutableCopy(); |
63 return; | 75 return; |
64 } | 76 } |
65 | 77 |
66 // We cannot use mergeAndOverrideOnConflict() here because it doesn't | 78 // We cannot use mergeAndOverrideOnConflict() here because it doesn't |
67 // respect the !important declaration (but addParsedProperty() does). | 79 // respect the !important declaration (but addParsedProperty() does). |
68 for (unsigned i = 0; i < propertyCount; ++i) | 80 for (unsigned i = 0; i < propertyCount; ++i) |
69 m_propertySet->addParsedProperty(propertySet->propertyAt(i).toCSSPropert
y()); | 81 m_propertySet->addParsedProperty(propertySet->propertyAt(i).toCSSPropert
y()); |
70 } | 82 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 case CSSValueAuto: | 197 case CSSValueAuto: |
186 return Length(); | 198 return Length(); |
187 default: | 199 default: |
188 // Unrecognized keyword. | 200 // Unrecognized keyword. |
189 ASSERT_NOT_REACHED(); | 201 ASSERT_NOT_REACHED(); |
190 return Length(0, Fixed); | 202 return Length(0, Fixed); |
191 } | 203 } |
192 } | 204 } |
193 | 205 |
194 } // namespace WebCore | 206 } // namespace WebCore |
OLD | NEW |