| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 for (curr = firstChildBox(); curr && curr->selectionState() == SelectionNone
; curr = curr->nextSiblingBox()) { } | 633 for (curr = firstChildBox(); curr && curr->selectionState() == SelectionNone
; curr = curr->nextSiblingBox()) { } |
| 634 | 634 |
| 635 for (bool sawSelectionEnd = false; curr && !sawSelectionEnd; curr = curr->ne
xtSiblingBox()) { | 635 for (bool sawSelectionEnd = false; curr && !sawSelectionEnd; curr = curr->ne
xtSiblingBox()) { |
| 636 SelectionState childState = curr->selectionState(); | 636 SelectionState childState = curr->selectionState(); |
| 637 if (childState == SelectionBoth || childState == SelectionEnd) | 637 if (childState == SelectionBoth || childState == SelectionEnd) |
| 638 sawSelectionEnd = true; | 638 sawSelectionEnd = true; |
| 639 | 639 |
| 640 if (curr->isFloatingOrOutOfFlowPositioned()) | 640 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 641 continue; // We must be a normal flow object in order to even be con
sidered. | 641 continue; // We must be a normal flow object in order to even be con
sidered. |
| 642 | 642 |
| 643 if (curr->isRelPositioned() && curr->hasLayer()) { | |
| 644 // If the relposition offset is anything other than 0, then treat th
is just like an absolute positioned element. | |
| 645 // Just disregard it completely. | |
| 646 LayoutSize relOffset = curr->layer()->offsetForInFlowPosition(); | |
| 647 if (relOffset.width() || relOffset.height()) | |
| 648 continue; | |
| 649 } | |
| 650 | |
| 651 bool paintsOwnSelection = curr->shouldPaintSelectionGaps(); | 643 bool paintsOwnSelection = curr->shouldPaintSelectionGaps(); |
| 652 bool fillBlockGaps = paintsOwnSelection || (curr->canBeSelectionLeaf() &
& childState != SelectionNone); | 644 bool fillBlockGaps = paintsOwnSelection || (curr->canBeSelectionLeaf() &
& childState != SelectionNone); |
| 653 if (fillBlockGaps) { | 645 if (fillBlockGaps) { |
| 654 // We need to fill the vertical gap above this object. | 646 // We need to fill the vertical gap above this object. |
| 655 if (childState == SelectionEnd || childState == SelectionInside) | 647 if (childState == SelectionEnd || childState == SelectionInside) |
| 656 // Fill the gap above the object. | 648 // Fill the gap above the object. |
| 657 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysica
lPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRigh
t, | 649 result.uniteCenter(blockSelectionGap(rootBlock, rootBlockPhysica
lPosition, offsetFromRootBlock, lastLogicalTop, lastLogicalLeft, lastLogicalRigh
t, |
| 658 curr->logicalTop(), paintIn
fo)); | 650 curr->logicalTop(), paintIn
fo)); |
| 659 | 651 |
| 660 // Only fill side gaps for objects that paint their own selection if
we know for sure the selection is going to extend all the way *past* | 652 // Only fill side gaps for objects that paint their own selection if
we know for sure the selection is going to extend all the way *past* |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) | 1102 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) |
| 1111 || ancestor->node()->hasEditableStyle() == child->node()->hasEditableSty
le(); | 1103 || ancestor->node()->hasEditableStyle() == child->node()->hasEditableSty
le(); |
| 1112 } | 1104 } |
| 1113 | 1105 |
| 1114 // FIXME: This function should go on RenderObject as an instance method. Then | 1106 // FIXME: This function should go on RenderObject as an instance method. Then |
| 1115 // all cases in which positionForPoint recurs could call this instead to | 1107 // all cases in which positionForPoint recurs could call this instead to |
| 1116 // prevent crossing editable boundaries. This would require many tests. | 1108 // prevent crossing editable boundaries. This would require many tests. |
| 1117 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) | 1109 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) |
| 1118 { | 1110 { |
| 1119 LayoutPoint childLocation = child->location(); | 1111 LayoutPoint childLocation = child->location(); |
| 1120 if (child->isRelPositioned()) | |
| 1121 childLocation += child->offsetForInFlowPosition(); | |
| 1122 | 1112 |
| 1123 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. | 1113 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. |
| 1124 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); | 1114 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); |
| 1125 | 1115 |
| 1126 // If this is an anonymous renderer, we just recur normally | 1116 // If this is an anonymous renderer, we just recur normally |
| 1127 Node* childNode = child->node(); | 1117 Node* childNode = child->node(); |
| 1128 if (!childNode) | 1118 if (!childNode) |
| 1129 return child->positionForPoint(pointInChildCoordinates); | 1119 return child->positionForPoint(pointInChildCoordinates); |
| 1130 | 1120 |
| 1131 // Otherwise, first make sure that the editability of the parent and child a
gree. | 1121 // Otherwise, first make sure that the editability of the parent and child a
gree. |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 const char* RenderBlock::renderName() const | 1614 const char* RenderBlock::renderName() const |
| 1625 { | 1615 { |
| 1626 if (isInlineBlock()) | 1616 if (isInlineBlock()) |
| 1627 return "RenderBlock (inline-block)"; | 1617 return "RenderBlock (inline-block)"; |
| 1628 if (isOutOfFlowPositioned()) | 1618 if (isOutOfFlowPositioned()) |
| 1629 return "RenderBlock (positioned)"; | 1619 return "RenderBlock (positioned)"; |
| 1630 if (isAnonymousBlock()) | 1620 if (isAnonymousBlock()) |
| 1631 return "RenderBlock (anonymous)"; | 1621 return "RenderBlock (anonymous)"; |
| 1632 if (isAnonymous()) | 1622 if (isAnonymous()) |
| 1633 return "RenderBlock (generated)"; | 1623 return "RenderBlock (generated)"; |
| 1634 if (isRelPositioned()) | |
| 1635 return "RenderBlock (relative positioned)"; | |
| 1636 return "RenderBlock"; | 1624 return "RenderBlock"; |
| 1637 } | 1625 } |
| 1638 | 1626 |
| 1639 // FIXME(sky): Clean up callers now that we no longer use the EDisplay argument. | 1627 // FIXME(sky): Clean up callers now that we no longer use the EDisplay argument. |
| 1640 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay) | 1628 RenderBlock* RenderBlock::createAnonymousWithParentRendererAndDisplay(const Rend
erObject* parent, EDisplay) |
| 1641 { | 1629 { |
| 1642 RenderBlock* newBox = RenderParagraph::createAnonymous(parent->document()); | 1630 RenderBlock* newBox = RenderParagraph::createAnonymous(parent->document()); |
| 1643 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), PARAGRAPH); | 1631 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), PARAGRAPH); |
| 1644 parent->updateAnonymousChildStyle(newBox, newStyle.get()); | 1632 parent->updateAnonymousChildStyle(newBox, newStyle.get()); |
| 1645 newBox->setStyle(newStyle.release()); | 1633 newBox->setStyle(newStyle.release()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 1738 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 1751 { | 1739 { |
| 1752 showRenderObject(); | 1740 showRenderObject(); |
| 1753 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 1741 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 1754 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 1742 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 1755 } | 1743 } |
| 1756 | 1744 |
| 1757 #endif | 1745 #endif |
| 1758 | 1746 |
| 1759 } // namespace blink | 1747 } // namespace blink |
| OLD | NEW |