| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
| 39 #include "core/dom/NodeRenderStyle.h" | 39 #include "core/dom/NodeRenderStyle.h" |
| 40 #include "core/dom/ViewportDescription.h" | 40 #include "core/dom/ViewportDescription.h" |
| 41 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); | 45 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); |
| 46 | 46 |
| 47 ViewportStyleResolver::ViewportStyleResolver(Document* document) | 47 ViewportStyleResolver::ViewportStyleResolver(Document* document) |
| 48 : m_document(document), | 48 : m_document(document) |
| 49 m_hasAuthorStyle(false) | 49 , m_hasAuthorStyle(false) |
| 50 { | 50 { |
| 51 ASSERT(m_document); | 51 ASSERT(m_document); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void ViewportStyleResolver::collectViewportRules(RuleSet* rules, Origin origin) | 54 void ViewportStyleResolver::collectViewportRules(RuleSet* rules, Origin origin) |
| 55 { | 55 { |
| 56 rules->compactRulesIfNeeded(); | 56 rules->compactRulesIfNeeded(); |
| 57 | 57 |
| 58 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> >& viewportRule
s = rules->viewportRules(); | 58 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> >& viewportRule
s = rules->viewportRules(); |
| 59 for (size_t i = 0; i < viewportRules.size(); ++i) | 59 for (size_t i = 0; i < viewportRules.size(); ++i) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 80 // respect the !important declaration (but addParsedProperty() does). | 80 // respect the !important declaration (but addParsedProperty() does). |
| 81 for (unsigned i = 0; i < propertyCount; ++i) | 81 for (unsigned i = 0; i < propertyCount; ++i) |
| 82 m_propertySet->addParsedProperty(propertySet.propertyAt(i).toCSSProperty
()); | 82 m_propertySet->addParsedProperty(propertySet.propertyAt(i).toCSSProperty
()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ViewportStyleResolver::resolve() | 85 void ViewportStyleResolver::resolve() |
| 86 { | 86 { |
| 87 if (!m_document) | 87 if (!m_document) |
| 88 return; | 88 return; |
| 89 | 89 |
| 90 if (!m_propertySet || (!m_hasAuthorStyle && m_document->hasLegacyViewportTag
())) { | 90 if (!m_propertySet) { |
| 91 ASSERT(!m_hasAuthorStyle); | 91 m_document->setViewportDescription(ViewportDescription(ViewportDescripti
on::UserAgentStyleSheet)); |
| 92 m_propertySet = nullptr; | |
| 93 m_document->setViewportDescription(ViewportDescription()); | |
| 94 return; | 92 return; |
| 95 } | 93 } |
| 96 | 94 |
| 97 ViewportDescription description(m_hasAuthorStyle ? ViewportDescription::Auth
orStyleSheet : ViewportDescription::UserAgentStyleSheet); | 95 ViewportDescription description(m_hasAuthorStyle ? ViewportDescription::Auth
orStyleSheet : ViewportDescription::UserAgentStyleSheet); |
| 98 | 96 |
| 99 description.userZoom = viewportArgumentValue(CSSPropertyUserZoom); | 97 description.userZoom = viewportArgumentValue(CSSPropertyUserZoom); |
| 100 description.zoom = viewportArgumentValue(CSSPropertyZoom); | 98 description.zoom = viewportArgumentValue(CSSPropertyZoom); |
| 101 description.minZoom = viewportArgumentValue(CSSPropertyMinZoom); | 99 description.minZoom = viewportArgumentValue(CSSPropertyMinZoom); |
| 102 description.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom); | 100 description.maxZoom = viewportArgumentValue(CSSPropertyMaxZoom); |
| 103 description.minWidth = viewportLengthValue(CSSPropertyMinWidth); | 101 description.minWidth = viewportLengthValue(CSSPropertyMinWidth); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 196 |
| 199 return result; | 197 return result; |
| 200 } | 198 } |
| 201 | 199 |
| 202 void ViewportStyleResolver::trace(Visitor* visitor) | 200 void ViewportStyleResolver::trace(Visitor* visitor) |
| 203 { | 201 { |
| 204 visitor->trace(m_propertySet); | 202 visitor->trace(m_propertySet); |
| 205 } | 203 } |
| 206 | 204 |
| 207 } // namespace WebCore | 205 } // namespace WebCore |
| OLD | NEW |