OLD | NEW |
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 private: | 149 private: |
150 const RenderBlock* m_block; | 150 const RenderBlock* m_block; |
151 bool m_shouldDispatchEvent; | 151 bool m_shouldDispatchEvent; |
152 bool m_hadHorizontalLayoutOverflow; | 152 bool m_hadHorizontalLayoutOverflow; |
153 bool m_hadVerticalLayoutOverflow; | 153 bool m_hadVerticalLayoutOverflow; |
154 }; | 154 }; |
155 | 155 |
156 RenderBlock::RenderBlock(ContainerNode* node) | 156 RenderBlock::RenderBlock(ContainerNode* node) |
157 : RenderBox(node) | 157 : RenderBox(node) |
158 , m_lineHeight(-1) | |
159 , m_hasMarginBeforeQuirk(false) | 158 , m_hasMarginBeforeQuirk(false) |
160 , m_hasMarginAfterQuirk(false) | 159 , m_hasMarginAfterQuirk(false) |
161 , m_beingDestroyed(false) | 160 , m_beingDestroyed(false) |
162 , m_hasMarkupTruncation(false) | 161 , m_hasMarkupTruncation(false) |
163 , m_hasBorderOrPaddingLogicalWidthChanged(false) | 162 , m_hasBorderOrPaddingLogicalWidthChanged(false) |
164 , m_hasOnlySelfCollapsingChildren(false) | 163 , m_hasOnlySelfCollapsingChildren(false) |
165 { | 164 { |
166 setChildrenInline(true); | 165 setChildrenInline(true); |
167 } | 166 } |
168 | 167 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 currCont->setContinuation(0); | 343 currCont->setContinuation(0); |
345 currCont->setStyle(newStyle); | 344 currCont->setStyle(newStyle); |
346 currCont->setContinuation(nextCont); | 345 currCont->setContinuation(nextCont); |
347 } | 346 } |
348 } | 347 } |
349 | 348 |
350 if (FastTextAutosizer* textAutosizer = document().fastTextAutosizer()) | 349 if (FastTextAutosizer* textAutosizer = document().fastTextAutosizer()) |
351 textAutosizer->record(this); | 350 textAutosizer->record(this); |
352 | 351 |
353 propagateStyleToAnonymousChildren(true); | 352 propagateStyleToAnonymousChildren(true); |
354 invalidateLineHeight(); | |
355 | 353 |
356 // It's possible for our border/padding to change, but for the overall logic
al width of the block to | 354 // It's possible for our border/padding to change, but for the overall logic
al width of the block to |
357 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. | 355 // end up being the same. We keep track of this change so in layoutBlock, we
can know to set relayoutChildren=true. |
358 m_hasBorderOrPaddingLogicalWidthChanged = oldStyle && diff.needsFullLayout()
&& needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle); | 356 m_hasBorderOrPaddingLogicalWidthChanged = oldStyle && diff.needsFullLayout()
&& needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle); |
359 | 357 |
360 // If the style has unloaded images, want to notify the ResourceLoadPriority
Optimizer so that | 358 // If the style has unloaded images, want to notify the ResourceLoadPriority
Optimizer so that |
361 // network priorities can be set. | 359 // network priorities can be set. |
362 Vector<ImageResource*> images; | 360 Vector<ImageResource*> images; |
363 appendImagesFromStyle(images, *newStyle); | 361 appendImagesFromStyle(images, *newStyle); |
364 if (images.isEmpty()) | 362 if (images.isEmpty()) |
(...skipping 3412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3777 | 3775 |
3778 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const | 3776 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const |
3779 { | 3777 { |
3780 // Inline blocks are replaced elements. Otherwise, just pass off to | 3778 // Inline blocks are replaced elements. Otherwise, just pass off to |
3781 // the base class. If we're being queried as though we're the root line | 3779 // the base class. If we're being queried as though we're the root line |
3782 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 3780 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
3783 // just like a block. | 3781 // just like a block. |
3784 if (isReplaced() && linePositionMode == PositionOnContainingLine) | 3782 if (isReplaced() && linePositionMode == PositionOnContainingLine) |
3785 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 3783 return RenderBox::lineHeight(firstLine, direction, linePositionMode); |
3786 | 3784 |
3787 if (firstLine && document().styleEngine()->usesFirstLineRules()) { | 3785 RenderStyle* s = style(firstLine && document().styleEngine()->usesFirstLineR
ules()); |
3788 RenderStyle* s = style(firstLine); | 3786 return s->computedLineHeight(); |
3789 if (s != style()) | |
3790 return s->computedLineHeight(); | |
3791 } | |
3792 | |
3793 if (m_lineHeight == -1) | |
3794 m_lineHeight = style()->computedLineHeight(); | |
3795 | |
3796 return m_lineHeight; | |
3797 } | 3787 } |
3798 | 3788 |
3799 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const | 3789 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const |
3800 { | 3790 { |
3801 return direction == HorizontalLine ? marginTop() : marginRight(); | 3791 return direction == HorizontalLine ? marginTop() : marginRight(); |
3802 } | 3792 } |
3803 | 3793 |
3804 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const | 3794 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const |
3805 { | 3795 { |
3806 // Inline blocks are replaced elements. Otherwise, just pass off to | 3796 // Inline blocks are replaced elements. Otherwise, just pass off to |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5047 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5037 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5048 { | 5038 { |
5049 showRenderObject(); | 5039 showRenderObject(); |
5050 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5040 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5051 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5041 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5052 } | 5042 } |
5053 | 5043 |
5054 #endif | 5044 #endif |
5055 | 5045 |
5056 } // namespace WebCore | 5046 } // namespace WebCore |
OLD | NEW |