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

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: 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
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 const ViewportDescription& viewportDescription = m_document->page()->mainFra me()->document()->viewportDescription();
213 if (viewportDescription.type == ViewportDescription::UserAgentStyleSheet) {
pdr. 2013/10/29 02:04:44 Can you add this as a helper on ViewportDescriptio
skobes 2013/10/29 17:43:32 Done.
214 multiplier *= m_document->settings()->deviceScaleAdjustment();
215 }
211 return std::max(1.0f, multiplier); 216 return std::max(1.0f, multiplier);
212 } 217 }
213 218
214 void TextAutosizer::processClusterInternal(TextAutosizingClusterInfo& clusterInf o, RenderBlock* container, RenderObject* subtreeRoot, const TextAutosizingWindow Info& windowInfo, float multiplier) 219 void TextAutosizer::processClusterInternal(TextAutosizingClusterInfo& clusterInf o, RenderBlock* container, RenderObject* subtreeRoot, const TextAutosizingWindow Info& windowInfo, float multiplier)
215 { 220 {
216 processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo ); 221 processContainer(multiplier, container, clusterInfo, subtreeRoot, windowInfo );
217 222
218 Vector<Vector<TextAutosizingClusterInfo> > narrowDescendantsGroups; 223 Vector<Vector<TextAutosizingClusterInfo> > narrowDescendantsGroups;
219 getNarrowDescendantsGroupedByWidth(clusterInfo, narrowDescendantsGroups); 224 getNarrowDescendantsGroupedByWidth(clusterInfo, narrowDescendantsGroups);
220 for (size_t i = 0; i < narrowDescendantsGroups.size(); ++i) 225 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()) { 729 if (i + 1 < clusterInfos.size()) {
725 float currentWidth = clusterInfos[i].root->contentLogicalWidth(); 730 float currentWidth = clusterInfos[i].root->contentLogicalWidth();
726 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth(); 731 float nextWidth = clusterInfos[i + 1].root->contentLogicalWidth();
727 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup) 732 if (currentWidth - nextWidth > maxWidthDifferenceWithinGroup)
728 groups.grow(groups.size() + 1); 733 groups.grow(groups.size() + 1);
729 } 734 }
730 } 735 }
731 } 736 }
732 737
733 } // namespace WebCore 738 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698