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 3975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3986 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); | 3986 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); |
3987 | 3987 |
3988 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); | 3988 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); |
3989 | 3989 |
3990 if (extraWidthToEndOfLine) | 3990 if (extraWidthToEndOfLine) |
3991 *extraWidthToEndOfLine = width() - caretRect.maxX(); | 3991 *extraWidthToEndOfLine = width() - caretRect.maxX(); |
3992 | 3992 |
3993 return caretRect; | 3993 return caretRect; |
3994 } | 3994 } |
3995 | 3995 |
3996 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset, const RenderLayerModelObject* paintContainer) const | 3996 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset) const |
3997 { | 3997 { |
3998 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the | 3998 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the |
3999 // inline boxes above and below us (thus getting merged with them to form a
single irregular | 3999 // inline boxes above and below us (thus getting merged with them to form a
single irregular |
4000 // shape). | 4000 // shape). |
4001 if (inlineElementContinuation()) { | 4001 if (inlineElementContinuation()) { |
4002 // FIXME: This check really isn't accurate. | 4002 // FIXME: This check really isn't accurate. |
4003 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); | 4003 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); |
4004 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. | 4004 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. |
4005 // FIXME: This is wrong for block-flows that are horizontal. | 4005 // FIXME: This is wrong for block-flows that are horizontal. |
4006 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4006 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
4007 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); | 4007 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); |
4008 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); | 4008 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); |
4009 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); | 4009 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); |
4010 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); | 4010 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); |
4011 if (!rect.isEmpty()) | 4011 if (!rect.isEmpty()) |
4012 rects.append(rect); | 4012 rects.append(rect); |
4013 } else if (width() && height()) { | 4013 } else if (width() && height()) { |
4014 rects.append(LayoutRect(additionalOffset, size())); | 4014 rects.append(LayoutRect(additionalOffset, size())); |
4015 } | 4015 } |
4016 | 4016 |
4017 if (!hasOverflowClip() && !hasControlClip()) { | 4017 if (!hasOverflowClip() && !hasControlClip()) { |
4018 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4018 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4019 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4019 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4020 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4020 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
4021 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); | 4021 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); |
4022 if (!rect.isEmpty()) | 4022 if (!rect.isEmpty()) |
4023 rects.append(rect); | 4023 rects.append(rect); |
4024 } | 4024 } |
4025 | 4025 |
4026 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 4026 addChildFocusRingRects(rects, additionalOffset); |
4027 } | 4027 } |
4028 | 4028 |
4029 if (inlineElementContinuation()) | 4029 if (inlineElementContinuation()) |
4030 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location()), pain
tContainer); | 4030 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location())); |
4031 } | 4031 } |
4032 | 4032 |
4033 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const | 4033 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const |
4034 { | 4034 { |
4035 RenderBox::computeSelfHitTestRects(rects, layerOffset); | 4035 RenderBox::computeSelfHitTestRects(rects, layerOffset); |
4036 | 4036 |
4037 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { | 4037 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { |
4038 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4038 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4039 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4039 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4040 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4040 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4384 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4384 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
4385 { | 4385 { |
4386 showRenderObject(); | 4386 showRenderObject(); |
4387 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4387 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
4388 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4388 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
4389 } | 4389 } |
4390 | 4390 |
4391 #endif | 4391 #endif |
4392 | 4392 |
4393 } // namespace blink | 4393 } // namespace blink |
OLD | NEW |