| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // if we're invisible or haven't received a layout yet, then just bail. | 191 // if we're invisible or haven't received a layout yet, then just bail. |
| 192 if (style()->visibility() != VISIBLE) | 192 if (style()->visibility() != VISIBLE) |
| 193 return false; | 193 return false; |
| 194 | 194 |
| 195 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 195 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
| 196 | 196 |
| 197 // Early exit if the element touches the edges. | 197 // Early exit if the element touches the edges. |
| 198 LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y(); | 198 LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y(); |
| 199 LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY(); | 199 LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY(); |
| 200 if (isSelected() && inlineBoxWrapper()) { | 200 if (isSelected() && inlineBoxWrapper()) { |
| 201 LayoutUnit selTop = paintOffset.y() + inlineBoxWrapper()->root()->select
ionTop(); | 201 LayoutUnit selTop = paintOffset.y() + inlineBoxWrapper()->root().selecti
onTop(); |
| 202 LayoutUnit selBottom = paintOffset.y() + selTop + inlineBoxWrapper()->ro
ot()->selectionHeight(); | 202 LayoutUnit selBottom = paintOffset.y() + selTop + inlineBoxWrapper()->ro
ot().selectionHeight(); |
| 203 top = min(selTop, top); | 203 top = min(selTop, top); |
| 204 bottom = max(selBottom, bottom); | 204 bottom = max(selBottom, bottom); |
| 205 } | 205 } |
| 206 | 206 |
| 207 LayoutRect localRepaintRect = paintInfo.rect; | 207 LayoutRect localRepaintRect = paintInfo.rect; |
| 208 localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase)); | 208 localRepaintRect.inflate(maximalOutlineSize(paintInfo.phase)); |
| 209 if (adjustedPaintOffset.x() + visualOverflowRect().x() >= localRepaintRect.m
axX() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= localRepaintRe
ct.x()) | 209 if (adjustedPaintOffset.x() + visualOverflowRect().x() >= localRepaintRect.m
axX() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= localRepaintRe
ct.x()) |
| 210 return false; | 210 return false; |
| 211 | 211 |
| 212 if (top >= localRepaintRect.maxY() || bottom <= localRepaintRect.y()) | 212 if (top >= localRepaintRect.maxY() || bottom <= localRepaintRect.y()) |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 m_minPreferredLogicalWidth += borderAndPadding; | 516 m_minPreferredLogicalWidth += borderAndPadding; |
| 517 m_maxPreferredLogicalWidth += borderAndPadding; | 517 m_maxPreferredLogicalWidth += borderAndPadding; |
| 518 | 518 |
| 519 clearPreferredLogicalWidthsDirty(); | 519 clearPreferredLogicalWidthsDirty(); |
| 520 } | 520 } |
| 521 | 521 |
| 522 PositionWithAffinity RenderReplaced::positionForPoint(const LayoutPoint& point) | 522 PositionWithAffinity RenderReplaced::positionForPoint(const LayoutPoint& point) |
| 523 { | 523 { |
| 524 // FIXME: This code is buggy if the replaced element is relative positioned. | 524 // FIXME: This code is buggy if the replaced element is relative positioned. |
| 525 InlineBox* box = inlineBoxWrapper(); | 525 InlineBox* box = inlineBoxWrapper(); |
| 526 RootInlineBox* rootBox = box ? box->root() : 0; | 526 RootInlineBox* rootBox = box ? &box->root() : 0; |
| 527 | 527 |
| 528 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop(); | 528 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop(); |
| 529 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom(); | 529 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom(); |
| 530 | 530 |
| 531 LayoutUnit blockDirectionPosition = isHorizontalWritingMode() ? point.y() +
y() : point.x() + x(); | 531 LayoutUnit blockDirectionPosition = isHorizontalWritingMode() ? point.y() +
y() : point.x() + x(); |
| 532 LayoutUnit lineDirectionPosition = isHorizontalWritingMode() ? point.x() + x
() : point.y() + y(); | 532 LayoutUnit lineDirectionPosition = isHorizontalWritingMode() ? point.x() + x
() : point.y() + y(); |
| 533 | 533 |
| 534 if (blockDirectionPosition < top) | 534 if (blockDirectionPosition < top) |
| 535 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); // coor
dinates are above | 535 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); // coor
dinates are above |
| 536 | 536 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 564 | 564 |
| 565 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const | 565 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const |
| 566 { | 566 { |
| 567 if (checkWhetherSelected && !isSelected()) | 567 if (checkWhetherSelected && !isSelected()) |
| 568 return LayoutRect(); | 568 return LayoutRect(); |
| 569 | 569 |
| 570 if (!inlineBoxWrapper()) | 570 if (!inlineBoxWrapper()) |
| 571 // We're a block-level replaced element. Just return our own dimensions
. | 571 // We're a block-level replaced element. Just return our own dimensions
. |
| 572 return LayoutRect(LayoutPoint(), size()); | 572 return LayoutRect(LayoutPoint(), size()); |
| 573 | 573 |
| 574 RootInlineBox* root = inlineBoxWrapper()->root(); | 574 RootInlineBox& root = inlineBoxWrapper()->root(); |
| 575 LayoutUnit newLogicalTop = root->block().style()->isFlippedBlocksWritingMode
() ? inlineBoxWrapper()->logicalBottom() - root->selectionBottom() : root->selec
tionTop() - inlineBoxWrapper()->logicalTop(); | 575 LayoutUnit newLogicalTop = root.block().style()->isFlippedBlocksWritingMode(
) ? inlineBoxWrapper()->logicalBottom() - root.selectionBottom() : root.selectio
nTop() - inlineBoxWrapper()->logicalTop(); |
| 576 if (root->block().style()->isHorizontalWritingMode()) | 576 if (root.block().style()->isHorizontalWritingMode()) |
| 577 return LayoutRect(0, newLogicalTop, width(), root->selectionHeight()); | 577 return LayoutRect(0, newLogicalTop, width(), root.selectionHeight()); |
| 578 return LayoutRect(newLogicalTop, 0, root->selectionHeight(), height()); | 578 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), height()); |
| 579 } | 579 } |
| 580 | 580 |
| 581 void RenderReplaced::setSelectionState(SelectionState state) | 581 void RenderReplaced::setSelectionState(SelectionState state) |
| 582 { | 582 { |
| 583 // The selection state for our containing block hierarchy is updated by the
base class call. | 583 // The selection state for our containing block hierarchy is updated by the
base class call. |
| 584 RenderBox::setSelectionState(state); | 584 RenderBox::setSelectionState(state); |
| 585 | 585 |
| 586 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) | 586 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) |
| 587 if (RootInlineBox* root = inlineBoxWrapper()->root()) | 587 inlineBoxWrapper()->root().setHasSelectedChildren(isSelected()); |
| 588 root->setHasSelectedChildren(isSelected()); | |
| 589 } | 588 } |
| 590 | 589 |
| 591 bool RenderReplaced::isSelected() const | 590 bool RenderReplaced::isSelected() const |
| 592 { | 591 { |
| 593 SelectionState s = selectionState(); | 592 SelectionState s = selectionState(); |
| 594 if (s == SelectionNone) | 593 if (s == SelectionNone) |
| 595 return false; | 594 return false; |
| 596 if (s == SelectionInside) | 595 if (s == SelectionInside) |
| 597 return true; | 596 return true; |
| 598 | 597 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 629 | 628 |
| 630 if (style()) { | 629 if (style()) { |
| 631 if (v) | 630 if (v) |
| 632 r.inflate(style()->outlineSize()); | 631 r.inflate(style()->outlineSize()); |
| 633 } | 632 } |
| 634 computeRectForRepaint(repaintContainer, r); | 633 computeRectForRepaint(repaintContainer, r); |
| 635 return r; | 634 return r; |
| 636 } | 635 } |
| 637 | 636 |
| 638 } | 637 } |
| OLD | NEW |