| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return computeMargin(this, style()->marginBeforeUsing(otherStyle ? otherStyl
e : style())); | 344 return computeMargin(this, style()->marginBeforeUsing(otherStyle ? otherStyl
e : style())); |
| 345 } | 345 } |
| 346 | 346 |
| 347 LayoutUnit RenderInline::marginAfter(const RenderStyle* otherStyle) const | 347 LayoutUnit RenderInline::marginAfter(const RenderStyle* otherStyle) const |
| 348 { | 348 { |
| 349 return computeMargin(this, style()->marginAfterUsing(otherStyle ? otherStyle
: style())); | 349 return computeMargin(this, style()->marginAfterUsing(otherStyle ? otherStyle
: style())); |
| 350 } | 350 } |
| 351 | 351 |
| 352 const char* RenderInline::renderName() const | 352 const char* RenderInline::renderName() const |
| 353 { | 353 { |
| 354 if (isRelPositioned()) | |
| 355 return "RenderInline (relative positioned)"; | |
| 356 if (isAnonymous()) | |
| 357 return "RenderInline (generated)"; | |
| 358 return "RenderInline"; | 354 return "RenderInline"; |
| 359 } | 355 } |
| 360 | 356 |
| 361 bool RenderInline::nodeAtPoint(const HitTestRequest& request, HitTestResult& res
ult, | 357 bool RenderInline::nodeAtPoint(const HitTestRequest& request, HitTestResult& res
ult, |
| 362 const HitTestLocation& locationInContainer, cons
t LayoutPoint& accumulatedOffset) | 358 const HitTestLocation& locationInContainer, cons
t LayoutPoint& accumulatedOffset) |
| 363 { | 359 { |
| 364 return m_lineBoxes.hitTest(this, request, result, locationInContainer, accum
ulatedOffset); | 360 return m_lineBoxes.hitTest(this, request, result, locationInContainer, accum
ulatedOffset); |
| 365 } | 361 } |
| 366 | 362 |
| 367 namespace { | 363 namespace { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 RootInlineBox& lastRootBox = lastLineBox()->root(); | 573 RootInlineBox& lastRootBox = lastLineBox()->root(); |
| 578 | 574 |
| 579 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); | 575 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); |
| 580 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 576 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
| 581 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; | 577 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; |
| 582 | 578 |
| 583 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 579 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
| 584 return rect; | 580 return rect; |
| 585 } | 581 } |
| 586 | 582 |
| 587 LayoutSize RenderInline::offsetFromContainer(const RenderObject* container, cons
t LayoutPoint& point, bool* offsetDependsOnPoint) const | |
| 588 { | |
| 589 ASSERT(container == this->container()); | |
| 590 | |
| 591 LayoutSize offset; | |
| 592 if (isRelPositioned()) | |
| 593 offset += offsetForInFlowPosition(); | |
| 594 | |
| 595 // FIXME(sky): Remove now that it's always false? | |
| 596 if (offsetDependsOnPoint) | |
| 597 *offsetDependsOnPoint = false; | |
| 598 | |
| 599 return offset; | |
| 600 } | |
| 601 | |
| 602 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode) const | 583 void RenderInline::mapLocalToContainer(const RenderLayerModelObject* paintInvali
dationContainer, TransformState& transformState, MapCoordinatesFlags mode) const |
| 603 { | 584 { |
| 604 if (paintInvalidationContainer == this) | 585 if (paintInvalidationContainer == this) |
| 605 return; | 586 return; |
| 606 | 587 |
| 607 bool containerSkipped; | 588 bool containerSkipped; |
| 608 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 589 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); |
| 609 if (!o) | 590 if (!o) |
| 610 return; | 591 return; |
| 611 | 592 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 return style()->computedLineHeight(); | 685 return style()->computedLineHeight(); |
| 705 } | 686 } |
| 706 | 687 |
| 707 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li
neDirectionMode direction, LinePositionMode linePositionMode) const | 688 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li
neDirectionMode direction, LinePositionMode linePositionMode) const |
| 708 { | 689 { |
| 709 ASSERT(linePositionMode == PositionOnContainingLine); | 690 ASSERT(linePositionMode == PositionOnContainingLine); |
| 710 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); | 691 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); |
| 711 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction,
linePositionMode) - fontMetrics.height()) / 2; | 692 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction,
linePositionMode) - fontMetrics.height()) / 2; |
| 712 } | 693 } |
| 713 | 694 |
| 714 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child)
const | |
| 715 { | |
| 716 // FIXME: This function isn't right with mixed writing modes. | |
| 717 | |
| 718 ASSERT(isRelPositioned()); | |
| 719 if (!isRelPositioned()) | |
| 720 return LayoutSize(); | |
| 721 | |
| 722 // When we have an enclosing relpositioned inline, we need to add in the off
set of the first line | |
| 723 // box from the rest of the content, but only in the cases where we know we'
re positioned | |
| 724 // relative to the inline itself. | |
| 725 | |
| 726 LayoutSize logicalOffset; | |
| 727 LayoutUnit inlinePosition; | |
| 728 LayoutUnit blockPosition; | |
| 729 if (firstLineBox()) { | |
| 730 inlinePosition = LayoutUnit::fromFloatRound(firstLineBox()->logicalLeft(
)); | |
| 731 blockPosition = firstLineBox()->logicalTop(); | |
| 732 } else { | |
| 733 inlinePosition = layer()->staticInlinePosition(); | |
| 734 blockPosition = layer()->staticBlockPosition(); | |
| 735 } | |
| 736 | |
| 737 // Per http://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width an abso
lute positioned box | |
| 738 // with a static position should locate itself as though it is a normal flow
box in relation to | |
| 739 // its containing block. If this relative-positioned inline has a negative o
ffset we need to | |
| 740 // compensate for it so that we align the positioned object with the edge of
its containing block. | |
| 741 if (child.style()->hasStaticInlinePosition()) | |
| 742 logicalOffset.setWidth(std::max(LayoutUnit(), -offsetForInFlowPosition()
.width())); | |
| 743 else | |
| 744 logicalOffset.setWidth(inlinePosition); | |
| 745 | |
| 746 if (!child.style()->hasStaticBlockPosition()) | |
| 747 logicalOffset.setHeight(blockPosition); | |
| 748 | |
| 749 return logicalOffset; | |
| 750 } | |
| 751 | |
| 752 namespace { | 695 namespace { |
| 753 | 696 |
| 754 class AbsoluteRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteRectsGene
ratorContext { | 697 class AbsoluteRectsIgnoringEmptyRectsGeneratorContext : public AbsoluteRectsGene
ratorContext { |
| 755 public: | 698 public: |
| 756 AbsoluteRectsIgnoringEmptyRectsGeneratorContext(Vector<IntRect>& rects, cons
t LayoutPoint& accumulatedOffset) | 699 AbsoluteRectsIgnoringEmptyRectsGeneratorContext(Vector<IntRect>& rects, cons
t LayoutPoint& accumulatedOffset) |
| 757 : AbsoluteRectsGeneratorContext(rects, accumulatedOffset) { } | 700 : AbsoluteRectsGeneratorContext(rects, accumulatedOffset) { } |
| 758 | 701 |
| 759 void operator()(const FloatRect& rect) | 702 void operator()(const FloatRect& rect) |
| 760 { | 703 { |
| 761 if (!rect.isEmpty()) | 704 if (!rect.isEmpty()) |
| 762 AbsoluteRectsGeneratorContext::operator()(rect); | 705 AbsoluteRectsGeneratorContext::operator()(rect); |
| 763 } | 706 } |
| 764 }; | 707 }; |
| 765 | 708 |
| 766 } // unnamed namespace | 709 } // unnamed namespace |
| 767 | 710 |
| 768 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
additionalOffset, const RenderLayerModelObject* paintContainer) const | 711 void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
additionalOffset, const RenderLayerModelObject* paintContainer) const |
| 769 { | 712 { |
| 770 AbsoluteRectsIgnoringEmptyRectsGeneratorContext context(rects, additionalOff
set); | 713 AbsoluteRectsIgnoringEmptyRectsGeneratorContext context(rects, additionalOff
set); |
| 771 generateLineBoxRects(context); | 714 generateLineBoxRects(context); |
| 772 | 715 |
| 773 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 716 addChildFocusRingRects(rects, additionalOffset, paintContainer); |
| 774 } | 717 } |
| 775 | 718 |
| 776 } // namespace blink | 719 } // namespace blink |
| OLD | NEW |