Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/ViewportStyleResolver.cpp

Issue 2414343002: Implement MediaValues for initial viewport. (Closed)
Patch Set: CORE_EXPORT in inheritance chain for Windows Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "core/css/resolver/ViewportStyleResolver.h" 30 #include "core/css/resolver/ViewportStyleResolver.h"
31 31
32 #include "core/CSSValueKeywords.h" 32 #include "core/CSSValueKeywords.h"
33 #include "core/css/CSSDefaultStyleSheets.h" 33 #include "core/css/CSSDefaultStyleSheets.h"
34 #include "core/css/CSSPrimitiveValueMappings.h" 34 #include "core/css/CSSPrimitiveValueMappings.h"
35 #include "core/css/CSSToLengthConversionData.h" 35 #include "core/css/CSSToLengthConversionData.h"
36 #include "core/css/MediaValuesDynamic.h" 36 #include "core/css/MediaValuesInitialViewport.h"
37 #include "core/css/StylePropertySet.h" 37 #include "core/css/StylePropertySet.h"
38 #include "core/css/StyleRule.h" 38 #include "core/css/StyleRule.h"
39 #include "core/css/StyleSheetContents.h" 39 #include "core/css/StyleSheetContents.h"
40 #include "core/css/resolver/ScopedStyleResolver.h" 40 #include "core/css/resolver/ScopedStyleResolver.h"
41 #include "core/dom/Document.h" 41 #include "core/dom/Document.h"
42 #include "core/dom/NodeComputedStyle.h" 42 #include "core/dom/NodeComputedStyle.h"
43 #include "core/dom/ViewportDescription.h" 43 #include "core/dom/ViewportDescription.h"
44 #include "core/frame/Settings.h" 44 #include "core/frame/Settings.h"
45 #include "core/layout/api/LayoutViewItem.h" 45 #include "core/layout/api/LayoutViewItem.h"
46 46
47 namespace blink { 47 namespace blink {
48 48
49 ViewportStyleResolver::ViewportStyleResolver(Document& document) 49 ViewportStyleResolver::ViewportStyleResolver(Document& document)
50 : m_document(document), m_hasAuthorStyle(false) { 50 : m_document(document), m_hasAuthorStyle(false) {
51 DCHECK(document.frame()); 51 DCHECK(document.frame());
52 // TODO(rune@opera.com): The MediaValues object passed here should reflect the 52 m_initialViewportMedium = new MediaQueryEvaluator(
53 // initial viewport, not the actual viewport. See https://crbug.com/332763 53 MediaValuesInitialViewport::create(*document.frame()));
54 m_initialViewportMedium =
55 new MediaQueryEvaluator(MediaValuesDynamic::create(document.frame()));
56 } 54 }
57 55
58 void ViewportStyleResolver::collectViewportRulesFromUASheets() { 56 void ViewportStyleResolver::collectViewportRulesFromUASheets() {
59 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance(); 57 CSSDefaultStyleSheets& defaultStyleSheets = CSSDefaultStyleSheets::instance();
60 WebViewportStyle viewportStyle = m_document->settings() 58 WebViewportStyle viewportStyle = m_document->settings()
61 ? m_document->settings()->viewportStyle() 59 ? m_document->settings()->viewportStyle()
62 : WebViewportStyle::Default; 60 : WebViewportStyle::Default;
63 StyleSheetContents* viewportContents = nullptr; 61 StyleSheetContents* viewportContents = nullptr;
64 switch (viewportStyle) { 62 switch (viewportStyle) {
65 case WebViewportStyle::Default: 63 case WebViewportStyle::Default:
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return result; 263 return result;
266 } 264 }
267 265
268 DEFINE_TRACE(ViewportStyleResolver) { 266 DEFINE_TRACE(ViewportStyleResolver) {
269 visitor->trace(m_document); 267 visitor->trace(m_document);
270 visitor->trace(m_propertySet); 268 visitor->trace(m_propertySet);
271 visitor->trace(m_initialViewportMedium); 269 visitor->trace(m_initialViewportMedium);
272 } 270 }
273 271
274 } // namespace blink 272 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698