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

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

Issue 351033003: Simplify use of styleOrFirstLineStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@rename-style-bool-to-0
Patch Set: Created 6 years, 6 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/RenderInline.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 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after
3740 3740
3741 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const 3741 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
3742 { 3742 {
3743 // Inline blocks are replaced elements. Otherwise, just pass off to 3743 // Inline blocks are replaced elements. Otherwise, just pass off to
3744 // the base class. If we're being queried as though we're the root line 3744 // the base class. If we're being queried as though we're the root line
3745 // box, then the fact that we're an inline-block is irrelevant, and we behav e 3745 // box, then the fact that we're an inline-block is irrelevant, and we behav e
3746 // just like a block. 3746 // just like a block.
3747 if (isReplaced() && linePositionMode == PositionOnContainingLine) 3747 if (isReplaced() && linePositionMode == PositionOnContainingLine)
3748 return RenderBox::lineHeight(firstLine, direction, linePositionMode); 3748 return RenderBox::lineHeight(firstLine, direction, linePositionMode);
3749 3749
3750 RenderStyle* s = styleOrFirstLineStyle(firstLine && document().styleEngine() ->usesFirstLineRules()); 3750 return styleOrFirstLineStyle(firstLine)->computedLineHeight();
3751 return s->computedLineHeight();
3752 } 3751 }
3753 3752
3754 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const 3753 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const
3755 { 3754 {
3756 return direction == HorizontalLine ? marginTop() : marginRight(); 3755 return direction == HorizontalLine ? marginTop() : marginRight();
3757 } 3756 }
3758 3757
3759 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin eDirectionMode direction, LinePositionMode linePositionMode) const 3758 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin eDirectionMode direction, LinePositionMode linePositionMode) const
3760 { 3759 {
3761 // Inline blocks are replaced elements. Otherwise, just pass off to 3760 // Inline blocks are replaced elements. Otherwise, just pass off to
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizo ntalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)) ; 3814 return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizo ntalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)) ;
3816 } 3815 }
3817 3816
3818 int RenderBlock::firstLineBoxBaseline() const 3817 int RenderBlock::firstLineBoxBaseline() const
3819 { 3818 {
3820 if (isWritingModeRoot() && !isRubyRun()) 3819 if (isWritingModeRoot() && !isRubyRun())
3821 return -1; 3820 return -1;
3822 3821
3823 if (childrenInline()) { 3822 if (childrenInline()) {
3824 if (firstLineBox()) 3823 if (firstLineBox())
3825 return firstLineBox()->logicalTop() + styleOrFirstLineStyle(true)->f ontMetrics().ascent(firstRootBox()->baselineType()); 3824 return firstLineBox()->logicalTop() + firstLineStyle()->fontMetrics( ).ascent(firstRootBox()->baselineType());
3826 else 3825 else
3827 return -1; 3826 return -1;
3828 } 3827 }
3829 else { 3828 else {
3830 for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBo x()) { 3829 for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBo x()) {
3831 if (!curr->isFloatingOrOutOfFlowPositioned()) { 3830 if (!curr->isFloatingOrOutOfFlowPositioned()) {
3832 int result = curr->firstLineBoxBaseline(); 3831 int result = curr->firstLineBoxBaseline();
3833 if (result != -1) 3832 if (result != -1)
3834 return curr->logicalTop() + result; // Translate to our coor dinate space. 3833 return curr->logicalTop() + result; // Translate to our coor dinate space.
3835 } 3834 }
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5019 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5020 { 5019 {
5021 showRenderObject(); 5020 showRenderObject();
5022 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5023 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5024 } 5023 }
5025 5024
5026 #endif 5025 #endif
5027 5026
5028 } // namespace WebCore 5027 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBR.cpp ('k') | Source/core/rendering/RenderInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698