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

Side by Side Diff: Source/core/rendering/RenderBlock.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/RenderBR.cpp ('k') | Source/core/rendering/RenderBox.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 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 if (!hasPercentHeightDescendant(box)) 2908 if (!hasPercentHeightDescendant(box))
2909 continue; 2909 continue;
2910 2910
2911 removePercentHeightDescendant(box); 2911 removePercentHeightDescendant(box);
2912 } 2912 }
2913 } 2913 }
2914 2914
2915 LayoutUnit RenderBlock::textIndentOffset() const 2915 LayoutUnit RenderBlock::textIndentOffset() const
2916 { 2916 {
2917 LayoutUnit cw = 0; 2917 LayoutUnit cw = 0;
2918 RenderView* renderView = 0;
2919 if (style()->textIndent().isPercent()) 2918 if (style()->textIndent().isPercent())
2920 cw = containingBlock()->availableLogicalWidth(); 2919 cw = containingBlock()->availableLogicalWidth();
2921 else if (style()->textIndent().isViewportPercentage()) 2920 return minimumValueForLength(style()->textIndent(), cw);
2922 renderView = view();
2923 return minimumValueForLength(style()->textIndent(), cw, renderView);
2924 } 2921 }
2925 2922
2926 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const 2923 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const
2927 { 2924 {
2928 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLe ft() + paddingLeft() : borderTop() + paddingTop(); 2925 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLe ft() + paddingLeft() : borderTop() + paddingTop();
2929 if (!region) 2926 if (!region)
2930 return logicalLeftOffset; 2927 return logicalLeftOffset;
2931 LayoutRect boxRect = borderBoxRectInRegion(region); 2928 LayoutRect boxRect = borderBoxRectInRegion(region);
2932 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRec t.y()); 2929 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRec t.y());
2933 } 2930 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 } else if (hitTestColumns(request, result, locationInContainer, toLayout Point(scrolledOffset), hitTestAction)) { 3113 } else if (hitTestColumns(request, result, locationInContainer, toLayout Point(scrolledOffset), hitTestAction)) {
3117 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset)); 3114 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset));
3118 return true; 3115 return true;
3119 } 3116 }
3120 } 3117 }
3121 3118
3122 // Check if the point is outside radii. 3119 // Check if the point is outside radii.
3123 if (!isRenderView() && style()->hasBorderRadius()) { 3120 if (!isRenderView() && style()->hasBorderRadius()) {
3124 LayoutRect borderRect = borderBoxRect(); 3121 LayoutRect borderRect = borderBoxRect();
3125 borderRect.moveBy(adjustedLocation); 3122 borderRect.moveBy(adjustedLocation);
3126 RoundedRect border = style()->getRoundedBorderFor(borderRect, view()); 3123 RoundedRect border = style()->getRoundedBorderFor(borderRect);
3127 if (!locationInContainer.intersects(border)) 3124 if (!locationInContainer.intersects(border))
3128 return false; 3125 return false;
3129 } 3126 }
3130 3127
3131 // Now hit test our background 3128 // Now hit test our background
3132 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) { 3129 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild BlockBackground) {
3133 LayoutRect boundsRect(adjustedLocation, size()); 3130 LayoutRect boundsRect(adjustedLocation, size());
3134 if (visibleToHitTestRequest(request) && locationInContainer.intersects(b oundsRect)) { 3131 if (visibleToHitTestRequest(request) && locationInContainer.intersects(b oundsRect)) {
3135 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset)); 3132 updateHitTestResult(result, flipForWritingMode(locationInContainer.p oint() - localOffset));
3136 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect)) 3133 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request, locationInContainer, boundsRect))
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
4098 bool autoWrap, oldAutoWrap; 4095 bool autoWrap, oldAutoWrap;
4099 autoWrap = oldAutoWrap = styleToUse->autoWrap(); 4096 autoWrap = oldAutoWrap = styleToUse->autoWrap();
4100 4097
4101 InlineMinMaxIterator childIterator(this); 4098 InlineMinMaxIterator childIterator(this);
4102 4099
4103 // Only gets added to the max preffered width once. 4100 // Only gets added to the max preffered width once.
4104 bool addedTextIndent = false; 4101 bool addedTextIndent = false;
4105 // Signals the text indent was more negative than the min preferred width 4102 // Signals the text indent was more negative than the min preferred width
4106 bool hasRemainingNegativeTextIndent = false; 4103 bool hasRemainingNegativeTextIndent = false;
4107 4104
4108 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw, view()); 4105 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw);
4109 RenderObject* prevFloat = 0; 4106 RenderObject* prevFloat = 0;
4110 bool isPrevChildInlineFlow = false; 4107 bool isPrevChildInlineFlow = false;
4111 bool shouldBreakLineAfterText = false; 4108 bool shouldBreakLineAfterText = false;
4112 while (RenderObject* child = childIterator.next()) { 4109 while (RenderObject* child = childIterator.next()) {
4113 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : 4110 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() :
4114 child->style()->autoWrap(); 4111 child->style()->autoWrap();
4115 4112
4116 if (!child->isBR()) { 4113 if (!child->isBR()) {
4117 // Step One: determine whether or not we need to go ahead and 4114 // Step One: determine whether or not we need to go ahead and
4118 // terminate our current line. Each discrete chunk can become 4115 // terminate our current line. Each discrete chunk can become
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
4502 // Inline blocks are replaced elements. Otherwise, just pass off to 4499 // Inline blocks are replaced elements. Otherwise, just pass off to
4503 // the base class. If we're being queried as though we're the root line 4500 // the base class. If we're being queried as though we're the root line
4504 // box, then the fact that we're an inline-block is irrelevant, and we behav e 4501 // box, then the fact that we're an inline-block is irrelevant, and we behav e
4505 // just like a block. 4502 // just like a block.
4506 if (isReplaced() && linePositionMode == PositionOnContainingLine) 4503 if (isReplaced() && linePositionMode == PositionOnContainingLine)
4507 return RenderBox::lineHeight(firstLine, direction, linePositionMode); 4504 return RenderBox::lineHeight(firstLine, direction, linePositionMode);
4508 4505
4509 if (firstLine && document().styleEngine()->usesFirstLineRules()) { 4506 if (firstLine && document().styleEngine()->usesFirstLineRules()) {
4510 RenderStyle* s = style(firstLine); 4507 RenderStyle* s = style(firstLine);
4511 if (s != style()) 4508 if (s != style())
4512 return s->computedLineHeight(view()); 4509 return s->computedLineHeight();
4513 } 4510 }
4514 4511
4515 if (m_lineHeight == -1) 4512 if (m_lineHeight == -1)
4516 m_lineHeight = style()->computedLineHeight(view()); 4513 m_lineHeight = style()->computedLineHeight();
4517 4514
4518 return m_lineHeight; 4515 return m_lineHeight;
4519 } 4516 }
4520 4517
4521 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin eDirectionMode direction, LinePositionMode linePositionMode) const 4518 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin eDirectionMode direction, LinePositionMode linePositionMode) const
4522 { 4519 {
4523 // Inline blocks are replaced elements. Otherwise, just pass off to 4520 // Inline blocks are replaced elements. Otherwise, just pass off to
4524 // the base class. If we're being queried as though we're the root line 4521 // the base class. If we're being queried as though we're the root line
4525 // box, then the fact that we're an inline-block is irrelevant, and we behav e 4522 // box, then the fact that we're an inline-block is irrelevant, and we behav e
4526 // just like a block. 4523 // just like a block.
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
5791 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5788 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5792 { 5789 {
5793 showRenderObject(); 5790 showRenderObject();
5794 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5791 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5795 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5792 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5796 } 5793 }
5797 5794
5798 #endif 5795 #endif
5799 5796
5800 } // namespace WebCore 5797 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBR.cpp ('k') | Source/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698