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

Side by Side Diff: Source/core/css/resolver/StyleAdjuster.cpp

Issue 215503003: Reland text autosizing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/css/resolver/StyleAdjuster.h" 30 #include "core/css/resolver/StyleAdjuster.h"
31 31
32 #include "HTMLNames.h" 32 #include "HTMLNames.h"
33 #include "SVGNames.h" 33 #include "SVGNames.h"
34 #include "core/dom/ContainerNode.h" 34 #include "core/dom/ContainerNode.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/Element.h" 36 #include "core/dom/Element.h"
37 #include "core/dom/NodeRenderStyle.h"
37 #include "core/html/HTMLIFrameElement.h" 38 #include "core/html/HTMLIFrameElement.h"
38 #include "core/html/HTMLInputElement.h" 39 #include "core/html/HTMLInputElement.h"
39 #include "core/html/HTMLTableCellElement.h" 40 #include "core/html/HTMLTableCellElement.h"
40 #include "core/html/HTMLTextAreaElement.h" 41 #include "core/html/HTMLTextAreaElement.h"
41 #include "core/frame/FrameView.h" 42 #include "core/frame/FrameView.h"
42 #include "core/frame/Settings.h" 43 #include "core/frame/Settings.h"
43 #include "core/rendering/RenderTheme.h" 44 #include "core/rendering/RenderTheme.h"
44 #include "core/rendering/style/GridPosition.h" 45 #include "core/rendering/style/GridPosition.h"
45 #include "core/rendering/style/RenderStyle.h" 46 #include "core/rendering/style/RenderStyle.h"
46 #include "core/rendering/style/RenderStyleConstants.h" 47 #include "core/rendering/style/RenderStyleConstants.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 309
309 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb ject content should 310 // RenderSVGRoot handles zooming for the whole SVG subtree, so foreignOb ject content should
310 // not be scaled again. 311 // not be scaled again.
311 if (isSVGForeignObjectElement(*e)) 312 if (isSVGForeignObjectElement(*e))
312 style->setEffectiveZoom(RenderStyle::initialZoom()); 313 style->setEffectiveZoom(RenderStyle::initialZoom());
313 314
314 // SVG text layout code expects us to be a block-level style element. 315 // SVG text layout code expects us to be a block-level style element.
315 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is DisplayInlineType()) 316 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is DisplayInlineType())
316 style->setDisplay(BLOCK); 317 style->setDisplay(BLOCK);
317 } 318 }
319
320 if (e && e->renderStyle() && e->renderStyle()->textAutosizingMultiplier() != 1) {
321 // Preserve the text autosizing multiplier on style recalc.
322 // (The autosizer will update it during layout if it needs to be changed .)
323 style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMulti plier());
324 style->setUnique();
325 }
318 } 326 }
319 327
320 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element) 328 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element)
321 { 329 {
322 // <div> and <span> are the most common elements on the web, we skip all the work for them. 330 // <div> and <span> are the most common elements on the web, we skip all the work for them.
323 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) 331 if (isHTMLDivElement(element) || isHTMLSpanElement(element))
324 return; 332 return;
325 333
326 if (isHTMLTableCellElement(element)) { 334 if (isHTMLTableCellElement(element)) {
327 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property. 335 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 447 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
440 style->setWritingMode(TopToBottomWritingMode); 448 style->setWritingMode(TopToBottomWritingMode);
441 449
442 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentS tyle->display())) { 450 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentS tyle->display())) {
443 style->setFloating(NoFloat); 451 style->setFloating(NoFloat);
444 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 452 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
445 } 453 }
446 } 454 }
447 455
448 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698