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

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

Issue 82083002: Move viewport unit resolution to style recalc time (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: rename browser zoom to page zoom Created 6 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
« no previous file with comments | « Source/core/rendering/RenderGrid.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('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) 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 } 689 }
690 690
691 static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg in) 691 static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg in)
692 { 692 {
693 if (margin.isAuto()) 693 if (margin.isAuto())
694 return 0; 694 return 0;
695 if (margin.isFixed()) 695 if (margin.isFixed())
696 return margin.value(); 696 return margin.value();
697 if (margin.isPercent()) 697 if (margin.isPercent())
698 return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->contai ningBlock()->availableLogicalWidth())); 698 return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->contai ningBlock()->availableLogicalWidth()));
699 if (margin.isViewportPercentage())
700 return valueForLength(margin, 0, renderer->view());
701 return 0; 699 return 0;
702 } 700 }
703 701
704 LayoutUnit RenderInline::marginLeft() const 702 LayoutUnit RenderInline::marginLeft() const
705 { 703 {
706 return computeMargin(this, style()->marginLeft()); 704 return computeMargin(this, style()->marginLeft());
707 } 705 }
708 706
709 LayoutUnit RenderInline::marginRight() const 707 LayoutUnit RenderInline::marginRight() const
710 { 708 {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 InlineFlowBox* flowBox = createInlineFlowBox(); 1281 InlineFlowBox* flowBox = createInlineFlowBox();
1284 m_lineBoxes.appendLineBox(flowBox); 1282 m_lineBoxes.appendLineBox(flowBox);
1285 return flowBox; 1283 return flowBox;
1286 } 1284 }
1287 1285
1288 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const 1286 LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*directio n*/, LinePositionMode /*linePositionMode*/) const
1289 { 1287 {
1290 if (firstLine && document().styleEngine()->usesFirstLineRules()) { 1288 if (firstLine && document().styleEngine()->usesFirstLineRules()) {
1291 RenderStyle* s = style(firstLine); 1289 RenderStyle* s = style(firstLine);
1292 if (s != style()) 1290 if (s != style())
1293 return s->computedLineHeight(view()); 1291 return s->computedLineHeight();
1294 } 1292 }
1295 1293
1296 return style()->computedLineHeight(view()); 1294 return style()->computedLineHeight();
1297 } 1295 }
1298 1296
1299 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1297 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
1300 { 1298 {
1301 ASSERT(linePositionMode == PositionOnContainingLine); 1299 ASSERT(linePositionMode == PositionOnContainingLine);
1302 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 1300 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
1303 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1301 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1304 } 1302 }
1305 1303
1306 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const 1304 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 container = this; 1574 container = this;
1577 1575
1578 FloatPoint absPos = container->localToAbsolute(); 1576 FloatPoint absPos = container->localToAbsolute();
1579 region.bounds.setX(absPos.x() + region.bounds.x()); 1577 region.bounds.setX(absPos.x() + region.bounds.x());
1580 region.bounds.setY(absPos.y() + region.bounds.y()); 1578 region.bounds.setY(absPos.y() + region.bounds.y());
1581 1579
1582 regions.append(region); 1580 regions.append(region);
1583 } 1581 }
1584 1582
1585 } // namespace WebCore 1583 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderGrid.cpp ('k') | Source/core/rendering/RenderMenuList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698