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 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4105 bool autoWrap, oldAutoWrap; | 4102 bool autoWrap, oldAutoWrap; |
4106 autoWrap = oldAutoWrap = styleToUse->autoWrap(); | 4103 autoWrap = oldAutoWrap = styleToUse->autoWrap(); |
4107 | 4104 |
4108 InlineMinMaxIterator childIterator(this); | 4105 InlineMinMaxIterator childIterator(this); |
4109 | 4106 |
4110 // Only gets added to the max preffered width once. | 4107 // Only gets added to the max preffered width once. |
4111 bool addedTextIndent = false; | 4108 bool addedTextIndent = false; |
4112 // Signals the text indent was more negative than the min preferred width | 4109 // Signals the text indent was more negative than the min preferred width |
4113 bool hasRemainingNegativeTextIndent = false; | 4110 bool hasRemainingNegativeTextIndent = false; |
4114 | 4111 |
4115 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw,
view()); | 4112 LayoutUnit textIndent = minimumValueForLength(styleToUse->textIndent(), cw); |
4116 RenderObject* prevFloat = 0; | 4113 RenderObject* prevFloat = 0; |
4117 bool isPrevChildInlineFlow = false; | 4114 bool isPrevChildInlineFlow = false; |
4118 bool shouldBreakLineAfterText = false; | 4115 bool shouldBreakLineAfterText = false; |
4119 while (RenderObject* child = childIterator.next()) { | 4116 while (RenderObject* child = childIterator.next()) { |
4120 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : | 4117 autoWrap = child->isReplaced() ? child->parent()->style()->autoWrap() : |
4121 child->style()->autoWrap(); | 4118 child->style()->autoWrap(); |
4122 | 4119 |
4123 if (!child->isBR()) { | 4120 if (!child->isBR()) { |
4124 // Step One: determine whether or not we need to go ahead and | 4121 // Step One: determine whether or not we need to go ahead and |
4125 // terminate our current line. Each discrete chunk can become | 4122 // terminate our current line. Each discrete chunk can become |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4499 // Inline blocks are replaced elements. Otherwise, just pass off to | 4496 // Inline blocks are replaced elements. Otherwise, just pass off to |
4500 // the base class. If we're being queried as though we're the root line | 4497 // the base class. If we're being queried as though we're the root line |
4501 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 4498 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
4502 // just like a block. | 4499 // just like a block. |
4503 if (isReplaced() && linePositionMode == PositionOnContainingLine) | 4500 if (isReplaced() && linePositionMode == PositionOnContainingLine) |
4504 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 4501 return RenderBox::lineHeight(firstLine, direction, linePositionMode); |
4505 | 4502 |
4506 if (firstLine && document().styleEngine()->usesFirstLineRules()) { | 4503 if (firstLine && document().styleEngine()->usesFirstLineRules()) { |
4507 RenderStyle* s = style(firstLine); | 4504 RenderStyle* s = style(firstLine); |
4508 if (s != style()) | 4505 if (s != style()) |
4509 return s->computedLineHeight(view()); | 4506 return s->computedLineHeight(); |
4510 } | 4507 } |
4511 | 4508 |
4512 if (m_lineHeight == -1) | 4509 if (m_lineHeight == -1) |
4513 m_lineHeight = style()->computedLineHeight(view()); | 4510 m_lineHeight = style()->computedLineHeight(); |
4514 | 4511 |
4515 return m_lineHeight; | 4512 return m_lineHeight; |
4516 } | 4513 } |
4517 | 4514 |
4518 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const | 4515 int RenderBlock::baselinePosition(FontBaseline baselineType, bool firstLine, Lin
eDirectionMode direction, LinePositionMode linePositionMode) const |
4519 { | 4516 { |
4520 // Inline blocks are replaced elements. Otherwise, just pass off to | 4517 // Inline blocks are replaced elements. Otherwise, just pass off to |
4521 // the base class. If we're being queried as though we're the root line | 4518 // the base class. If we're being queried as though we're the root line |
4522 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 4519 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
4523 // just like a block. | 4520 // just like a block. |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5796 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 5793 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
5797 { | 5794 { |
5798 showRenderObject(); | 5795 showRenderObject(); |
5799 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 5796 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
5800 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 5797 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
5801 } | 5798 } |
5802 | 5799 |
5803 #endif | 5800 #endif |
5804 | 5801 |
5805 } // namespace WebCore | 5802 } // namespace WebCore |
OLD | NEW |