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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 | 2554 |
2555 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) | 2555 LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width,
LayoutUnit textIndentOffset) |
2556 { | 2556 { |
2557 ASSERT(!slowFirstChild()); | 2557 ASSERT(!slowFirstChild()); |
2558 | 2558 |
2559 // FIXME: This does not take into account either :first-line or :first-lette
r | 2559 // FIXME: This does not take into account either :first-line or :first-lette
r |
2560 // However, as soon as some content is entered, the line boxes will be | 2560 // However, as soon as some content is entered, the line boxes will be |
2561 // constructed and this kludge is not called any more. So only the caret siz
e | 2561 // constructed and this kludge is not called any more. So only the caret siz
e |
2562 // of an empty :first-line'd block is wrong. I think we can live with that. | 2562 // of an empty :first-line'd block is wrong. I think we can live with that. |
2563 RenderStyle* currentStyle = firstLineStyle(); | 2563 RenderStyle* currentStyle = firstLineStyle(); |
2564 LayoutUnit height = style()->fontMetrics().height(); | |
2565 | 2564 |
2566 enum CaretAlignment { alignLeft, alignRight, alignCenter }; | 2565 enum CaretAlignment { alignLeft, alignRight, alignCenter }; |
2567 | 2566 |
2568 CaretAlignment alignment = alignLeft; | 2567 CaretAlignment alignment = alignLeft; |
2569 | 2568 |
2570 switch (currentStyle->textAlign()) { | 2569 switch (currentStyle->textAlign()) { |
2571 case LEFT: | 2570 case LEFT: |
2572 case WEBKIT_LEFT: | 2571 case WEBKIT_LEFT: |
2573 break; | 2572 break; |
2574 case CENTER: | 2573 case CENTER: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 x -= textIndentOffset / 2; | 2605 x -= textIndentOffset / 2; |
2607 break; | 2606 break; |
2608 case alignRight: | 2607 case alignRight: |
2609 x = maxX - caretWidth; | 2608 x = maxX - caretWidth; |
2610 if (!currentStyle->isLeftToRightDirection()) | 2609 if (!currentStyle->isLeftToRightDirection()) |
2611 x -= textIndentOffset; | 2610 x -= textIndentOffset; |
2612 break; | 2611 break; |
2613 } | 2612 } |
2614 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0)); | 2613 x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0)); |
2615 | 2614 |
2616 LayoutUnit y = paddingTop() + borderTop(); | 2615 LayoutUnit height = style()->fontMetrics().height(); |
2617 | 2616 LayoutUnit verticalSpace = lineHeight(true, currentStyle->isHorizontalWritin
gMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height; |
| 2617 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); |
2618 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth
, height) : LayoutRect(y, x, height, caretWidth); | 2618 return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth
, height) : LayoutRect(y, x, height, caretWidth); |
2619 } | 2619 } |
2620 | 2620 |
2621 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) | 2621 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) |
2622 { | 2622 { |
2623 // FIXME: We may want to not antialias when scaled by an integral value, | 2623 // FIXME: We may want to not antialias when scaled by an integral value, |
2624 // and we may want to antialias when translated by a non-integral value. | 2624 // and we may want to antialias when translated by a non-integral value. |
2625 // FIXME: See crbug.com/382491. getCTM does not include scale factors applie
d at raster time, such | 2625 // FIXME: See crbug.com/382491. getCTM does not include scale factors applie
d at raster time, such |
2626 // as device zoom. | 2626 // as device zoom. |
2627 return !context->getCTM().isIdentityOrTranslationOrFlipped(); | 2627 return !context->getCTM().isIdentityOrTranslationOrFlipped(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 2724 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); |
2725 for (RenderObject* child = startChild; child && child != endChild; ) { | 2725 for (RenderObject* child = startChild; child && child != endChild; ) { |
2726 // Save our next sibling as moveChildTo will clear it. | 2726 // Save our next sibling as moveChildTo will clear it. |
2727 RenderObject* nextSibling = child->nextSibling(); | 2727 RenderObject* nextSibling = child->nextSibling(); |
2728 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 2728 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
2729 child = nextSibling; | 2729 child = nextSibling; |
2730 } | 2730 } |
2731 } | 2731 } |
2732 | 2732 |
2733 } // namespace blink | 2733 } // namespace blink |
OLD | NEW |