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 4392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4403 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); | 4403 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); |
4404 | 4404 |
4405 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); | 4405 LayoutRect caretRect = localCaretRectForEmptyElement(width(), textIndentOffs
et()); |
4406 | 4406 |
4407 if (extraWidthToEndOfLine) | 4407 if (extraWidthToEndOfLine) |
4408 *extraWidthToEndOfLine = width() - caretRect.maxX(); | 4408 *extraWidthToEndOfLine = width() - caretRect.maxX(); |
4409 | 4409 |
4410 return caretRect; | 4410 return caretRect; |
4411 } | 4411 } |
4412 | 4412 |
4413 void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& a
dditionalOffset, const RenderLayerModelObject* paintContainer) const | 4413 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset, const RenderLayerModelObject* paintContainer) const |
4414 { | 4414 { |
4415 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the | 4415 // For blocks inside inlines, we go ahead and include margins so that we run
right up to the |
4416 // inline boxes above and below us (thus getting merged with them to form a
single irregular | 4416 // inline boxes above and below us (thus getting merged with them to form a
single irregular |
4417 // shape). | 4417 // shape). |
4418 if (inlineElementContinuation()) { | 4418 if (inlineElementContinuation()) { |
4419 // FIXME: This check really isn't accurate. | 4419 // FIXME: This check really isn't accurate. |
4420 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); | 4420 bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox(); |
4421 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. | 4421 // FIXME: This is wrong. The principal renderer may not be the continuat
ion preceding this block. |
4422 // FIXME: This is wrong for block-flows that are horizontal. | 4422 // FIXME: This is wrong for block-flows that are horizontal. |
4423 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 4423 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
4424 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); | 4424 bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->
node()->renderer())->firstLineBox(); |
4425 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); | 4425 LayoutUnit topMargin = prevInlineHasLineBox ? collapsedMarginBefore() :
LayoutUnit(); |
4426 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); | 4426 LayoutUnit bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter()
: LayoutUnit(); |
4427 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); | 4427 LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin,
width(), height() + topMargin + bottomMargin); |
4428 if (!rect.isEmpty()) | 4428 if (!rect.isEmpty()) |
4429 rects.append(pixelSnappedIntRect(rect)); | 4429 rects.append(rect); |
4430 } else if (width() && height()) { | 4430 } else if (width() && height()) { |
4431 rects.append(pixelSnappedIntRect(additionalOffset, size())); | 4431 rects.append(LayoutRect(additionalOffset, size())); |
4432 } | 4432 } |
4433 | 4433 |
4434 if (!hasOverflowClip() && !hasControlClip()) { | 4434 if (!hasOverflowClip() && !hasControlClip()) { |
4435 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4435 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4436 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4436 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4437 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4437 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
4438 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); | 4438 LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y
() + top, curr->width(), bottom - top); |
4439 if (!rect.isEmpty()) | 4439 if (!rect.isEmpty()) |
4440 rects.append(pixelSnappedIntRect(rect)); | 4440 rects.append(rect); |
4441 } | 4441 } |
4442 | 4442 |
4443 addChildFocusRingRects(rects, additionalOffset, paintContainer); | 4443 addChildFocusRingRects(rects, additionalOffset, paintContainer); |
4444 } | 4444 } |
4445 | 4445 |
4446 if (inlineElementContinuation()) | 4446 if (inlineElementContinuation()) |
4447 inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint
(additionalOffset + inlineElementContinuation()->containingBlock()->location() -
location()), paintContainer); | 4447 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location()), pain
tContainer); |
4448 } | 4448 } |
4449 | 4449 |
4450 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const | 4450 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const |
4451 { | 4451 { |
4452 RenderBox::computeSelfHitTestRects(rects, layerOffset); | 4452 RenderBox::computeSelfHitTestRects(rects, layerOffset); |
4453 | 4453 |
4454 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { | 4454 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { |
4455 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 4455 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
4456 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 4456 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
4457 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 4457 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4809 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4809 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
4810 { | 4810 { |
4811 showRenderObject(); | 4811 showRenderObject(); |
4812 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4812 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
4813 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4813 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
4814 } | 4814 } |
4815 | 4815 |
4816 #endif | 4816 #endif |
4817 | 4817 |
4818 } // namespace blink | 4818 } // namespace blink |
OLD | NEW |