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

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

Issue 1612683002: Reland of Don't change layout size due to top control show/hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 21 matching lines...) Expand all
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/StylePropertySet.h" 36 #include "core/css/StylePropertySet.h"
37 #include "core/css/StyleRule.h" 37 #include "core/css/StyleRule.h"
38 #include "core/css/resolver/ScopedStyleResolver.h" 38 #include "core/css/resolver/ScopedStyleResolver.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/NodeComputedStyle.h" 40 #include "core/dom/NodeComputedStyle.h"
41 #include "core/dom/ViewportDescription.h" 41 #include "core/dom/ViewportDescription.h"
42 #include "core/frame/FrameView.h"
43 #include "core/frame/Settings.h" 42 #include "core/frame/Settings.h"
44 43
45 namespace blink { 44 namespace blink {
46 45
47 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver); 46 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(ViewportStyleResolver);
48 47
49 ViewportStyleResolver::ViewportStyleResolver(Document* document) 48 ViewportStyleResolver::ViewportStyleResolver(Document* document)
50 : m_document(document) 49 : m_document(document)
51 , m_hasAuthorStyle(false) 50 , m_hasAuthorStyle(false)
52 { 51 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 193
195 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) 194 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom)
196 return Length(ExtendToZoom); 195 return Length(ExtendToZoom);
197 196
198 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); 197 ComputedStyle* documentStyle = m_document->mutableComputedStyle();
199 198
200 // If we have viewport units the conversion will mark the document style as having viewport units. 199 // If we have viewport units the conversion will mark the document style as having viewport units.
201 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); 200 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits();
202 documentStyle->setHasViewportUnits(false); 201 documentStyle->setHasViewportUnits(false);
203 202
204 FrameView* view = m_document->view();
205 float width = view ? view->width() : 0;
206 float height = view ? view->height() : 0;
207
208 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ; 203 CSSToLengthConversionData::FontSizes fontSizes(documentStyle, documentStyle) ;
209 CSSToLengthConversionData::ViewportSize viewportSize(width, height); 204 CSSToLengthConversionData::ViewportSize viewportSize(m_document->layoutView( ));
210 205
211 if (primitiveValue->getValueID() == CSSValueAuto) 206 if (primitiveValue->getValueID() == CSSValueAuto)
212 return Length(Auto); 207 return Length(Auto);
213 208
214 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do cumentStyle, fontSizes, viewportSize, 1.0f)); 209 Length result = primitiveValue->convertToLength(CSSToLengthConversionData(do cumentStyle, fontSizes, viewportSize, 1.0f));
215 if (documentStyle->hasViewportUnits()) 210 if (documentStyle->hasViewportUnits())
216 m_document->setHasViewportUnits(); 211 m_document->setHasViewportUnits();
217 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits); 212 documentStyle->setHasViewportUnits(documentStyleHasViewportUnits);
218 213
219 return result; 214 return result;
220 } 215 }
221 216
222 DEFINE_TRACE(ViewportStyleResolver) 217 DEFINE_TRACE(ViewportStyleResolver)
223 { 218 {
224 visitor->trace(m_propertySet); 219 visitor->trace(m_propertySet);
225 visitor->trace(m_document); 220 visitor->trace(m_document);
226 } 221 }
227 222
228 } // namespace blink 223 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698