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 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 if (!hasPercentHeightDescendant(box)) | 2916 if (!hasPercentHeightDescendant(box)) |
2917 continue; | 2917 continue; |
2918 | 2918 |
2919 removePercentHeightDescendant(box); | 2919 removePercentHeightDescendant(box); |
2920 } | 2920 } |
2921 } | 2921 } |
2922 | 2922 |
2923 LayoutUnit RenderBlock::textIndentOffset() const | 2923 LayoutUnit RenderBlock::textIndentOffset() const |
2924 { | 2924 { |
2925 LayoutUnit cw = 0; | 2925 LayoutUnit cw = 0; |
2926 RenderView* renderView = 0; | |
2927 if (style()->textIndent().isPercent()) | 2926 if (style()->textIndent().isPercent()) |
2928 cw = containingBlock()->availableLogicalWidth(); | 2927 cw = containingBlock()->availableLogicalWidth(); |
2929 else if (style()->textIndent().isViewportPercentage()) | 2928 return minimumValueForLength(style()->textIndent(), cw); |
2930 renderView = view(); | |
2931 return minimumValueForLength(style()->textIndent(), cw, renderView); | |
2932 } | 2929 } |
2933 | 2930 |
2934 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const | 2931 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const |
2935 { | 2932 { |
2936 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLe
ft() + paddingLeft() : borderTop() + paddingTop(); | 2933 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLe
ft() + paddingLeft() : borderTop() + paddingTop(); |
2937 if (!region) | 2934 if (!region) |
2938 return logicalLeftOffset; | 2935 return logicalLeftOffset; |
2939 LayoutRect boxRect = borderBoxRectInRegion(region); | 2936 LayoutRect boxRect = borderBoxRectInRegion(region); |
2940 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRec
t.y()); | 2937 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRec
t.y()); |
2941 } | 2938 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3124 } else if (hitTestColumns(request, result, locationInContainer, toLayout
Point(scrolledOffset), hitTestAction)) { | 3121 } else if (hitTestColumns(request, result, locationInContainer, toLayout
Point(scrolledOffset), hitTestAction)) { |
3125 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 3122 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
3126 return true; | 3123 return true; |
3127 } | 3124 } |
3128 } | 3125 } |
3129 | 3126 |
3130 // Check if the point is outside radii. | 3127 // Check if the point is outside radii. |
3131 if (!isRenderView() && style()->hasBorderRadius()) { | 3128 if (!isRenderView() && style()->hasBorderRadius()) { |
3132 LayoutRect borderRect = borderBoxRect(); | 3129 LayoutRect borderRect = borderBoxRect(); |
3133 borderRect.moveBy(adjustedLocation); | 3130 borderRect.moveBy(adjustedLocation); |
3134 RoundedRect border = style()->getRoundedBorderFor(borderRect, view()); | 3131 RoundedRect border = style()->getRoundedBorderFor(borderRect); |
3135 if (!locationInContainer.intersects(border)) | 3132 if (!locationInContainer.intersects(border)) |
3136 return false; | 3133 return false; |
3137 } | 3134 } |
3138 | 3135 |
3139 // Now hit test our background | 3136 // Now hit test our background |
3140 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { | 3137 if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChild
BlockBackground) { |
3141 LayoutRect boundsRect(adjustedLocation, size()); | 3138 LayoutRect boundsRect(adjustedLocation, size()); |
3142 if (visibleToHitTestRequest(request) && locationInContainer.intersects(b
oundsRect)) { | 3139 if (visibleToHitTestRequest(request) && locationInContainer.intersects(b
oundsRect)) { |
3143 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); | 3140 updateHitTestResult(result, flipForWritingMode(locationInContainer.p
oint() - localOffset)); |
3144 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request,
locationInContainer, boundsRect)) | 3141 if (!result.addNodeToRectBasedTestResult(nodeForHitTest(), request,
locationInContainer, boundsRect)) |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 bool autoWrap, oldAutoWrap; | 4103 bool autoWrap, oldAutoWrap; |
4107 autoWrap = oldAutoWrap = styleToUse->autoWrap(); | 4104 autoWrap = oldAutoWrap = styleToUse->autoWrap(); |
4108 | 4105 |
4109 InlineMinMaxIterator childIterator(this); | 4106 InlineMinMaxIterator childIterator(this); |
4110 | 4107 |
4111 // Only gets added to the max preffered width once. | 4108 // Only gets added to the max preffered width once. |
4112 bool addedTextIndent = false; | 4109 bool addedTextIndent = false; |
4113 // Signals the text indent was more negative than the min preferred width | 4110 // Signals the text indent was more negative than the min preferred width |
4114 bool hasRemainingNegativeTextIndent = false; | 4111 bool hasRemainingNegativeTextIndent = false; |
4115 | 4112 |
4116 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw,
view()); | 4113 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw); |
4117 RenderObject* prevFloat = 0; | 4114 RenderObject* prevFloat = 0; |
4118 bool isPrevChildInlineFlow = false; | 4115 bool isPrevChildInlineFlow = false; |
4119 bool shouldBreakLineAfterText = false; | 4116 bool shouldBreakLineAfterText = false; |
4120 while (RenderObject* child = childIterator.next()) { | 4117 while (RenderObject* child = childIterator.next()) { |
4121 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : | 4118 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : |
4122 child->style()->autoWrap(); | 4119 child->style()->autoWrap(); |
4123 | 4120 |
4124 if (!child->isBR()) { | 4121 if (!child->isBR()) { |
4125 // Step One: determine whether or not we need to go ahead and | 4122 // Step One: determine whether or not we need to go ahead and |
4126 // terminate our current line. Each discrete chunk can become | 4123 // terminate our current line. Each discrete chunk can become |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 // Inline blocks are replaced elements. Otherwise, just pass off to | 4507 // Inline blocks are replaced elements. Otherwise, just pass off to |
4511 // the base class. If we're being queried as though we're the root line | 4508 // the base class. If we're being queried as though we're the root line |
4512 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 4509 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
4513 // just like a block. | 4510 // just like a block. |
4514 if (isReplaced() && linePositionMode == PositionOnContainingLine) | 4511 if (isReplaced() && linePositionMode == PositionOnContainingLine) |
4515 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 4512 return RenderBox::lineHeight(firstLine, direction, linePositionMode); |
4516 | 4513 |
4517 if (firstLine && document().styleEngine()->usesFirstLineRules()) { | 4514 if (firstLine && document().styleEngine()->usesFirstLineRules()) { |
4518 RenderStyle* s = style(firstLine); | 4515 RenderStyle* s = style(firstLine); |
4519 if (s != style()) | 4516 if (s != style()) |
4520 return s->computedLineHeight(view()); | 4517 return s->computedLineHeight(); |
4521 } | 4518 } |
4522 | 4519 |
4523 if (m_lineHeight == -1) | 4520 if (m_lineHeight == -1) |
4524 m_lineHeight = style()->computedLineHeight(view()); | 4521 m_lineHeight = style()->computedLineHeight(); |
4525 | 4522 |
4526 return m_lineHeight; | 4523 return m_lineHeight; |
4527 } | 4524 } |
4528 | 4525 |
4529 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const | 4526 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const |
4530 { | 4527 { |
4531 // Inline blocks are replaced elements. Otherwise, just pass off to | 4528 // Inline blocks are replaced elements. Otherwise, just pass off to |
4532 // the base class. If we're being queried as though we're the root line | 4529 // the base class. If we're being queried as though we're the root line |
4533 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 4530 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
4534 // just like a block. | 4531 // just like a block. |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5799 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5796 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5800 { | 5797 { |
5801 showRenderObject(); | 5798 showRenderObject(); |
5802 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5799 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5803 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5800 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5804 } | 5801 } |
5805 | 5802 |
5806 #endif | 5803 #endif |
5807 | 5804 |
5808 } // namespace WebCore | 5805 } // namespace WebCore |
OLD | NEW |