| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 if (box->prevLeafChild() && caretOffset == 0) | 748 if (box->prevLeafChild() && caretOffset == 0) |
| 749 caretBox = box->prevLeafChild(); | 749 caretBox = box->prevLeafChild(); |
| 750 } else { | 750 } else { |
| 751 if (box->nextLeafChild() && caretOffset == 0) | 751 if (box->nextLeafChild() && caretOffset == 0) |
| 752 caretBox = box->nextLeafChild(); | 752 caretBox = box->nextLeafChild(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 // Get caret height from a font of character. | 755 // Get caret height from a font of character. |
| 756 const ComputedStyle* styleToUse = | 756 const ComputedStyle* styleToUse = |
| 757 caretBox->getLineLayoutItem().style(caretBox->isFirstLineStyle()); | 757 caretBox->getLineLayoutItem().style(caretBox->isFirstLineStyle()); |
| 758 if (!styleToUse->font().primaryFont()) |
| 759 return LayoutRect(); |
| 760 |
| 758 int height = styleToUse->font().primaryFont()->getFontMetrics().height(); | 761 int height = styleToUse->font().primaryFont()->getFontMetrics().height(); |
| 759 int top = caretBox->logicalTop().toInt(); | 762 int top = caretBox->logicalTop().toInt(); |
| 760 | 763 |
| 761 // Go ahead and round left to snap it to the nearest pixel. | 764 // Go ahead and round left to snap it to the nearest pixel. |
| 762 LayoutUnit left = box->positionForOffset(caretOffset); | 765 LayoutUnit left = box->positionForOffset(caretOffset); |
| 763 | 766 |
| 764 // Distribute the caret's width to either side of the offset. | 767 // Distribute the caret's width to either side of the offset. |
| 765 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2; | 768 LayoutUnit caretWidthLeftOfOffset = caretWidth() / 2; |
| 766 left -= caretWidthLeftOfOffset; | 769 left -= caretWidthLeftOfOffset; |
| 767 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset; | 770 LayoutUnit caretWidthRightOfOffset = caretWidth() - caretWidthLeftOfOffset; |
| (...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 LayoutRect rect = LayoutRect( | 2009 LayoutRect rect = LayoutRect( |
| 2007 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); | 2010 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); |
| 2008 LayoutBlock* block = containingBlock(); | 2011 LayoutBlock* block = containingBlock(); |
| 2009 if (block && hasTextBoxes()) | 2012 if (block && hasTextBoxes()) |
| 2010 block->adjustChildDebugRect(rect); | 2013 block->adjustChildDebugRect(rect); |
| 2011 | 2014 |
| 2012 return rect; | 2015 return rect; |
| 2013 } | 2016 } |
| 2014 | 2017 |
| 2015 } // namespace blink | 2018 } // namespace blink |
| OLD | NEW |