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

Side by Side Diff: third_party/WebKit/Source/core/dom/ViewportDescription.cpp

Issue 2390543002: Reflow comments in core/dom/. (Closed)
Patch Set: Reformat comments in core/dom/. 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights
7 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * reserved.
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. 11 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
10 * 12 *
11 * This library is free software; you can redistribute it and/or 13 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public 14 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either 15 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version. 16 * version 2 of the License, or (at your option) any later version.
15 * 17 *
16 * This library is distributed in the hope that it will be useful, 18 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 84
83 PageScaleConstraints ViewportDescription::resolve( 85 PageScaleConstraints ViewportDescription::resolve(
84 const FloatSize& initialViewportSize, 86 const FloatSize& initialViewportSize,
85 Length legacyFallbackWidth) const { 87 Length legacyFallbackWidth) const {
86 float resultWidth = ValueAuto; 88 float resultWidth = ValueAuto;
87 89
88 Length copyMaxWidth = maxWidth; 90 Length copyMaxWidth = maxWidth;
89 Length copyMinWidth = minWidth; 91 Length copyMinWidth = minWidth;
90 // In case the width (used for min- and max-width) is undefined. 92 // In case the width (used for min- and max-width) is undefined.
91 if (isLegacyViewportType() && maxWidth.isAuto()) { 93 if (isLegacyViewportType() && maxWidth.isAuto()) {
92 // The width viewport META property is translated into 'width' descriptors, setting 94 // The width viewport META property is translated into 'width' descriptors,
93 // the 'min' value to 'extend-to-zoom' and the 'max' value to the intended l ength. 95 // setting the 'min' value to 'extend-to-zoom' and the 'max' value to the
94 // In case the UA-defines a min-width, use that as length. 96 // intended length. In case the UA-defines a min-width, use that as length.
95 if (zoom == ViewportDescription::ValueAuto) { 97 if (zoom == ViewportDescription::ValueAuto) {
96 copyMinWidth = Length(ExtendToZoom); 98 copyMinWidth = Length(ExtendToZoom);
97 copyMaxWidth = legacyFallbackWidth; 99 copyMaxWidth = legacyFallbackWidth;
98 } else if (maxHeight.isAuto()) { 100 } else if (maxHeight.isAuto()) {
99 copyMinWidth = Length(ExtendToZoom); 101 copyMinWidth = Length(ExtendToZoom);
100 copyMaxWidth = Length(ExtendToZoom); 102 copyMaxWidth = Length(ExtendToZoom);
101 } 103 }
102 } 104 }
103 105
104 float resultMaxWidth = 106 float resultMaxWidth =
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 MetaHandheldFriendly, 241 MetaHandheldFriendly,
240 MetaMobileOptimized, 242 MetaMobileOptimized,
241 XhtmlMobileProfile, 243 XhtmlMobileProfile,
242 TypeCount 244 TypeCount
243 }; 245 };
244 246
245 if (!mainFrame || !mainFrame->host() || !mainFrame->view() || 247 if (!mainFrame || !mainFrame->host() || !mainFrame->view() ||
246 !mainFrame->document()) 248 !mainFrame->document())
247 return; 249 return;
248 250
249 // Avoid chrome:// pages like the new-tab page (on Android new tab is non-http ). 251 // Avoid chrome:// pages like the new-tab page (on Android new tab is
252 // non-http).
250 if (!mainFrame->document()->url().protocolIsInHTTPFamily()) 253 if (!mainFrame->document()->url().protocolIsInHTTPFamily())
251 return; 254 return;
252 255
253 DEFINE_STATIC_LOCAL(EnumerationHistogram, metaTagTypeHistogram, 256 DEFINE_STATIC_LOCAL(EnumerationHistogram, metaTagTypeHistogram,
254 ("Viewport.MetaTagType", TypeCount)); 257 ("Viewport.MetaTagType", TypeCount));
255 if (!isSpecifiedByAuthor()) { 258 if (!isSpecifiedByAuthor()) {
256 metaTagTypeHistogram.count(mainFrame->document()->isMobileDocument() 259 metaTagTypeHistogram.count(mainFrame->document()->isMobileDocument()
257 ? XhtmlMobileProfile 260 ? XhtmlMobileProfile
258 : NoViewportTag); 261 : NoViewportTag);
259 return; 262 return;
260 } 263 }
261 264
262 if (isMetaViewportType()) { 265 if (isMetaViewportType()) {
263 if (maxWidth.type() == blink::Fixed) { 266 if (maxWidth.type() == blink::Fixed) {
264 metaTagTypeHistogram.count(ConstantWidth); 267 metaTagTypeHistogram.count(ConstantWidth);
265 268
266 if (mainFrame->view()) { 269 if (mainFrame->view()) {
267 // To get an idea of how "far" the viewport is from the device's ideal w idth, we 270 // To get an idea of how "far" the viewport is from the device's ideal
268 // report the zoom level that we'd need to be at for the entire page to be visible. 271 // width, we report the zoom level that we'd need to be at for the
272 // entire page to be visible.
269 int viewportWidth = maxWidth.intValue(); 273 int viewportWidth = maxWidth.intValue();
270 int windowWidth = mainFrame->host()->visualViewport().size().width(); 274 int windowWidth = mainFrame->host()->visualViewport().size().width();
271 int overviewZoomPercent = 275 int overviewZoomPercent =
272 100 * windowWidth / static_cast<float>(viewportWidth); 276 100 * windowWidth / static_cast<float>(viewportWidth);
273 DEFINE_STATIC_LOCAL(SparseHistogram, overviewZoomHistogram, 277 DEFINE_STATIC_LOCAL(SparseHistogram, overviewZoomHistogram,
274 ("Viewport.OverviewZoom")); 278 ("Viewport.OverviewZoom"));
275 overviewZoomHistogram.sample(overviewZoomPercent); 279 overviewZoomHistogram.sample(overviewZoomPercent);
276 } 280 }
277 281
278 } else if (maxWidth.type() == blink::DeviceWidth || 282 } else if (maxWidth.type() == blink::DeviceWidth ||
279 maxWidth.type() == blink::ExtendToZoom) { 283 maxWidth.type() == blink::ExtendToZoom) {
280 metaTagTypeHistogram.count(DeviceWidth); 284 metaTagTypeHistogram.count(DeviceWidth);
281 } else { 285 } else {
282 // Overflow bucket for cases we may be unaware of. 286 // Overflow bucket for cases we may be unaware of.
283 metaTagTypeHistogram.count(MetaWidthOther); 287 metaTagTypeHistogram.count(MetaWidthOther);
284 } 288 }
285 } else if (type == ViewportDescription::HandheldFriendlyMeta) { 289 } else if (type == ViewportDescription::HandheldFriendlyMeta) {
286 metaTagTypeHistogram.count(MetaHandheldFriendly); 290 metaTagTypeHistogram.count(MetaHandheldFriendly);
287 } else if (type == ViewportDescription::MobileOptimizedMeta) { 291 } else if (type == ViewportDescription::MobileOptimizedMeta) {
288 metaTagTypeHistogram.count(MobileOptimizedMeta); 292 metaTagTypeHistogram.count(MobileOptimizedMeta);
289 } 293 }
290 #endif 294 #endif
291 } 295 }
292 296
293 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const { 297 bool ViewportDescription::matchesHeuristicsForGpuRasterization() const {
294 return isSpecifiedByAuthor(); 298 return isSpecifiedByAuthor();
295 } 299 }
296 300
297 } // namespace blink 301 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ViewportDescription.h ('k') | third_party/WebKit/Source/core/dom/VisitedLinkState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698