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

Side by Side Diff: Source/core/rendering/TextAutosizer.cpp

Issue 49913005: Add Settings::deviceScaleAdjustment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments. Created 7 years, 1 month 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
« no previous file with comments | « Source/core/page/Settings.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 float TextAutosizer::clusterMultiplier(WritingMode writingMode, const TextAutosi zingWindowInfo& windowInfo, float textWidth) const 202 float TextAutosizer::clusterMultiplier(WritingMode writingMode, const TextAutosi zingWindowInfo& windowInfo, float textWidth) const
203 { 203 {
204 int logicalWindowWidth = isHorizontalWritingMode(writingMode) ? windowInfo.w indowSize.width() : windowInfo.windowSize.height(); 204 int logicalWindowWidth = isHorizontalWritingMode(writingMode) ? windowInfo.w indowSize.width() : windowInfo.windowSize.height();
205 int logicalLayoutWidth = isHorizontalWritingMode(writingMode) ? windowInfo.m inLayoutSize.width() : windowInfo.minLayoutSize.height(); 205 int logicalLayoutWidth = isHorizontalWritingMode(writingMode) ? windowInfo.m inLayoutSize.width() : windowInfo.minLayoutSize.height();
206 // Ignore box width in excess of the layout width, to avoid extreme multipli ers. 206 // Ignore box width in excess of the layout width, to avoid extreme multipli ers.
207 float logicalClusterWidth = std::min<float>(textWidth, logicalLayoutWidth); 207 float logicalClusterWidth = std::min<float>(textWidth, logicalLayoutWidth);
208 208
209 float multiplier = logicalClusterWidth / logicalWindowWidth; 209 float multiplier = logicalClusterWidth / logicalWindowWidth;
210 multiplier *= m_document->settings()->textAutosizingFontScaleFactor(); 210 multiplier *= m_document->settings()->textAutosizingFontScaleFactor();
211
212 // If the page has a meta viewport or @viewport, don't apply the device scal e adjustment.
213 const ViewportDescription& viewportDescription = m_document->page()->mainFra me()->document()->viewportDescription();
214 if (!viewportDescription.isSpecifiedByAuthor()) {
johnme 2013/11/05 18:56:40 Didn't we say we'd disable the fontScaleFactor if
skobes 2013/11/05 19:02:46 Actually what we are doing is disabling the 1.05-1
215 multiplier *= m_document->settings()->deviceScaleAdjustment();
216 }
211 return std::max(1.0f, multiplier); 217 return std::max(1.0f, multiplier);
212 } 218 }
213 219
214 void TextAutosizer::processClusterInternal(TextAutosizingClusterInfo& clusterInf o, RenderBlock* container, RenderObject* subtreeRoot, const TextAutosizingWindow Info& windowInfo, float multiplier) 220 void TextAutosizer::processClusterInternal(TextAutosizingClusterInfo& clusterInf o, RenderBlock* container, RenderObject* subtreeRoot, const TextAutosizingWindow Info& windowInfo, float multiplier)
215 { 221 {
216 processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo ); 222 processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo );
217 223
218 Vector<Vector<TextAutosizingClusterInfo> > narrowDescendantsGroups; 224 Vector<Vector<TextAutosizingClusterInfo> > narrowDescendantsGroups;
219 getNarrowDescendantsGroupedByWidth(clusterInfo, narrowDescendantsGroups); 225 getNarrowDescendantsGroupedByWidth(clusterInfo, narrowDescendantsGroups);
220 for (size_t i = 0; i < narrowDescendantsGroups.size(); ++i) 226 for (size_t i = 0; i < narrowDescendantsGroups.size(); ++i)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 if (i + 1 < clusterInfos.size()) { 730 if (i + 1 < clusterInfos.size()) {
725 float currentWidth = clusterInfos[i].root->contentLogicalWidth(); 731 float currentWidth = clusterInfos[i].root->contentLogicalWidth();
726 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth(); 732 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth();
727 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup) 733 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup)
728 groups.grow(groups.size() + 1); 734 groups.grow(groups.size() + 1);
729 } 735 }
730 } 736 }
731 } 737 }
732 738
733 } // namespace WebCore 739 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Settings.cpp ('k') | Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698