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 4417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); | 4428 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); |
4429 | 4429 |
4430 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); | 4430 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); |
4431 | 4431 |
4432 if (extraWidthToEndOfLine) | 4432 if (extraWidthToEndOfLine) |
4433 *extraWidthToEndOfLine = width() - caretRect.maxX(); | 4433 *extraWidthToEndOfLine = width() - caretRect.maxX(); |
4434 | 4434 |
4435 return caretRect; | 4435 return caretRect; |
4436 } | 4436 } |
4437 | 4437 |
4438 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
dditionalOffset, const RenderLayerModelObject* paintContainer) const | 4438 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset, const RenderLayerModelObject* paintContainer) const |
4439 { | 4439 { |
4440 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the | 4440 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the |
4441 // inline boxes above and below us (thus getting merged with them to form a
single irregular | 4441 // inline boxes above and below us (thus getting merged with them to form a
single irregular |
4442 // shape). | 4442 // shape). |
4443 if (inlineElementContinuation()) { | 4443 if (inlineElementContinuation()) { |
4444 // FIXME: This check really isn't accurate. | 4444 // FIXME: This check really isn't accurate. |
4445 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); | 4445 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); |
4446 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. | 4446 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. |
4447 // FIXME: This is wrong for block-flows that are horizontal. | 4447 // FIXME: This is wrong for block-flows that are horizontal. |
4448 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4448 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
4449 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); | 4449 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); |
4450 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); | 4450 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); |
4451 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); | 4451 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); |
4452 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); | 4452 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); |
4453 if (!rect.isEmpty()) | 4453 if (!rect.isEmpty()) |
4454 rects.append(pixelSnappedIntRect(rect)); | 4454 rects.append(rect); |
4455 } else if (width() && height()) { | 4455 } else if (width() && height()) { |
4456 rects.append(pixelSnappedIntRect(additionalOffset, size())); | 4456 rects.append(LayoutRect(additionalOffset, size())); |
4457 } | 4457 } |
4458 | 4458 |
4459 if (!hasOverflowClip() && !hasControlClip()) { | 4459 if (!hasOverflowClip() && !hasControlClip()) { |
4460 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4460 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4461 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4461 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4462 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4462 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
4463 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); | 4463 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); |
4464 if (!rect.isEmpty()) | 4464 if (!rect.isEmpty()) |
4465 rects.append(pixelSnappedIntRect(rect)); | 4465 rects.append(rect); |
4466 } | 4466 } |
4467 | 4467 |
4468 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 4468 addChildFocusRingRects(rects, additionalOffset, paintContainer); |
4469 } | 4469 } |
4470 | 4470 |
4471 if (inlineElementContinuation()) | 4471 if (inlineElementContinuation()) |
4472 inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint
(additionalOffset + inlineElementContinuation()->containingBlock()->location() -
location()), paintContainer); | 4472 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location()), pain
tContainer); |
4473 } | 4473 } |
4474 | 4474 |
4475 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const | 4475 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const |
4476 { | 4476 { |
4477 RenderBox::computeSelfHitTestRects(rects, layerOffset); | 4477 RenderBox::computeSelfHitTestRects(rects, layerOffset); |
4478 | 4478 |
4479 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { | 4479 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { |
4480 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4480 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4481 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4481 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4482 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4482 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4848 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4848 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
4849 { | 4849 { |
4850 showRenderObject(); | 4850 showRenderObject(); |
4851 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4851 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
4852 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4852 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
4853 } | 4853 } |
4854 | 4854 |
4855 #endif | 4855 #endif |
4856 | 4856 |
4857 } // namespace blink | 4857 } // namespace blink |
OLD | NEW |