| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
| 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 6 * Copyright (C) 2011 Torch Mobile (Beijing) CO. Ltd. All rights reserved. | 6 * Copyright (C) 2011 Torch Mobile (Beijing) CO. Ltd. 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 30 matching lines...) Expand all Loading... |
| 41 RenderObject* boxRenderer = renderer(); | 41 RenderObject* boxRenderer = renderer(); |
| 42 ASSERT(boxRenderer); | 42 ASSERT(boxRenderer); |
| 43 | 43 |
| 44 bool isPrinting = renderer()->document()->printing(); | 44 bool isPrinting = renderer()->document()->printing(); |
| 45 bool hasSelection = !isPrinting && selectionState() != RenderObject::Selecti
onNone; | 45 bool hasSelection = !isPrinting && selectionState() != RenderObject::Selecti
onNone; |
| 46 | 46 |
| 47 PaintInfo childPaintInfo(paintInfo); | 47 PaintInfo childPaintInfo(paintInfo); |
| 48 if (hasSelection) { | 48 if (hasSelection) { |
| 49 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) { | 49 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) { |
| 50 if (child->isSVGInlineTextBox()) | 50 if (child->isSVGInlineTextBox()) |
| 51 static_cast<SVGInlineTextBox*>(child)->paintSelectionBackground(
childPaintInfo); | 51 toSVGInlineTextBox(child)->paintSelectionBackground(childPaintIn
fo); |
| 52 else if (child->isSVGInlineFlowBox()) | 52 else if (child->isSVGInlineFlowBox()) |
| 53 static_cast<SVGInlineFlowBox*>(child)->paintSelectionBackground(
childPaintInfo); | 53 static_cast<SVGInlineFlowBox*>(child)->paintSelectionBackground(
childPaintInfo); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon
text::SaveGraphicsContext); | 57 SVGRenderingContext renderingContext(boxRenderer, paintInfo, SVGRenderingCon
text::SaveGraphicsContext); |
| 58 if (renderingContext.isRenderingPrepared()) { | 58 if (renderingContext.isRenderingPrepared()) { |
| 59 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) { | 59 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) { |
| 60 if (child->isSVGInlineTextBox()) | 60 if (child->isSVGInlineTextBox()) |
| 61 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(toRender
SVGInlineText(static_cast<SVGInlineTextBox*>(child)->textRenderer())); | 61 SVGInlineFlowBox::computeTextMatchMarkerRectForRenderer(toRender
SVGInlineText(toSVGInlineTextBox(child)->textRenderer())); |
| 62 | 62 |
| 63 child->paint(paintInfo, LayoutPoint(), 0, 0); | 63 child->paint(paintInfo, LayoutPoint(), 0, 0); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SVGRootInlineBox::markDirty(bool dirty) | 68 void SVGRootInlineBox::markDirty(bool dirty) |
| 69 { | 69 { |
| 70 if (dirty) | 70 if (dirty) |
| 71 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) | 71 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()
) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 layoutChildBoxes(this, &childRect); | 98 layoutChildBoxes(this, &childRect); |
| 99 layoutRootBox(childRect); | 99 layoutRootBox(childRect); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
LayoutEngine& characterLayout) | 102 void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGText
LayoutEngine& characterLayout) |
| 103 { | 103 { |
| 104 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { | 104 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { |
| 105 if (child->isSVGInlineTextBox()) { | 105 if (child->isSVGInlineTextBox()) { |
| 106 ASSERT(child->renderer()); | 106 ASSERT(child->renderer()); |
| 107 ASSERT(child->renderer()->isSVGInlineText()); | 107 ASSERT(child->renderer()->isSVGInlineText()); |
| 108 | 108 characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child)); |
| 109 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child); | |
| 110 characterLayout.layoutInlineTextBox(textBox); | |
| 111 } else { | 109 } else { |
| 112 // Skip generated content. | 110 // Skip generated content. |
| 113 Node* node = child->renderer()->node(); | 111 Node* node = child->renderer()->node(); |
| 114 if (!node) | 112 if (!node) |
| 115 continue; | 113 continue; |
| 116 | 114 |
| 117 ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox()); | 115 ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox()); |
| 118 | 116 |
| 119 SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child); | 117 SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child); |
| 120 bool isTextPath = node->hasTagName(SVGNames::textPathTag); | 118 bool isTextPath = node->hasTagName(SVGNames::textPathTag); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 136 } | 134 } |
| 137 | 135 |
| 138 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
ct) | 136 void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRe
ct) |
| 139 { | 137 { |
| 140 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { | 138 for (InlineBox* child = start->firstChild(); child; child = child->nextOnLin
e()) { |
| 141 FloatRect boxRect; | 139 FloatRect boxRect; |
| 142 if (child->isSVGInlineTextBox()) { | 140 if (child->isSVGInlineTextBox()) { |
| 143 ASSERT(child->renderer()); | 141 ASSERT(child->renderer()); |
| 144 ASSERT(child->renderer()->isSVGInlineText()); | 142 ASSERT(child->renderer()->isSVGInlineText()); |
| 145 | 143 |
| 146 SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child); | 144 SVGInlineTextBox* textBox = toSVGInlineTextBox(child); |
| 147 boxRect = textBox->calculateBoundaries(); | 145 boxRect = textBox->calculateBoundaries(); |
| 148 textBox->setX(boxRect.x()); | 146 textBox->setX(boxRect.x()); |
| 149 textBox->setY(boxRect.y()); | 147 textBox->setY(boxRect.y()); |
| 150 textBox->setLogicalWidth(boxRect.width()); | 148 textBox->setLogicalWidth(boxRect.width()); |
| 151 textBox->setLogicalHeight(boxRect.height()); | 149 textBox->setLogicalHeight(boxRect.height()); |
| 152 } else { | 150 } else { |
| 153 // Skip generated content. | 151 // Skip generated content. |
| 154 if (!child->renderer()->node()) | 152 if (!child->renderer()->node()) |
| 155 continue; | 153 continue; |
| 156 | 154 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 return; | 274 return; |
| 277 | 275 |
| 278 if (!(*last)->isSVGInlineTextBox() || !(*first)->isSVGInlineTextBox()) { | 276 if (!(*last)->isSVGInlineTextBox() || !(*first)->isSVGInlineTextBox()) { |
| 279 InlineBox* temp = *first; | 277 InlineBox* temp = *first; |
| 280 *first = *last; | 278 *first = *last; |
| 281 *last = temp; | 279 *last = temp; |
| 282 ++first; | 280 ++first; |
| 283 continue; | 281 continue; |
| 284 } | 282 } |
| 285 | 283 |
| 286 SVGInlineTextBox* firstTextBox = static_cast<SVGInlineTextBox*>(*first); | 284 SVGInlineTextBox* firstTextBox = toSVGInlineTextBox(*first); |
| 287 SVGInlineTextBox* lastTextBox = static_cast<SVGInlineTextBox*>(*last); | 285 SVGInlineTextBox* lastTextBox = toSVGInlineTextBox(*last); |
| 288 | 286 |
| 289 // Reordering is only necessary for BiDi text that is _absolutely_ posit
ioned. | 287 // Reordering is only necessary for BiDi text that is _absolutely_ posit
ioned. |
| 290 if (firstTextBox->len() == 1 && firstTextBox->len() == lastTextBox->len(
)) { | 288 if (firstTextBox->len() == 1 && firstTextBox->len() == lastTextBox->len(
)) { |
| 291 RenderSVGInlineText* firstContext = toRenderSVGInlineText(firstTextB
ox->textRenderer()); | 289 RenderSVGInlineText* firstContext = toRenderSVGInlineText(firstTextB
ox->textRenderer()); |
| 292 RenderSVGInlineText* lastContext = toRenderSVGInlineText(lastTextBox
->textRenderer()); | 290 RenderSVGInlineText* lastContext = toRenderSVGInlineText(lastTextBox
->textRenderer()); |
| 293 | 291 |
| 294 SVGTextLayoutAttributes* firstAttributes = 0; | 292 SVGTextLayoutAttributes* firstAttributes = 0; |
| 295 SVGTextLayoutAttributes* lastAttributes = 0; | 293 SVGTextLayoutAttributes* lastAttributes = 0; |
| 296 findFirstAndLastAttributesInVector(attributes, firstContext, lastCon
text, firstAttributes, lastAttributes); | 294 findFirstAndLastAttributesInVector(attributes, firstContext, lastCon
text, firstAttributes, lastAttributes); |
| 297 swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTe
xtBox->start(), lastTextBox->start()); | 295 swapItemsInLayoutAttributes(firstAttributes, lastAttributes, firstTe
xtBox->start(), lastTextBox->start()); |
| 298 } | 296 } |
| 299 | 297 |
| 300 InlineBox* temp = *first; | 298 InlineBox* temp = *first; |
| 301 *first = *last; | 299 *first = *last; |
| 302 *last = temp; | 300 *last = temp; |
| 303 | 301 |
| 304 ++first; | 302 ++first; |
| 305 } | 303 } |
| 306 } | 304 } |
| 307 | 305 |
| 308 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) | 306 void SVGRootInlineBox::reorderValueLists(Vector<SVGTextLayoutAttributes*>& attri
butes) |
| 309 { | 307 { |
| 310 Vector<InlineBox*> leafBoxesInLogicalOrder; | 308 Vector<InlineBox*> leafBoxesInLogicalOrder; |
| 311 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); | 309 collectLeafBoxesInLogicalOrder(leafBoxesInLogicalOrder, reverseInlineBoxRang
eAndValueListsIfNeeded, &attributes); |
| 312 } | 310 } |
| 313 | 311 |
| 314 } // namespace WebCore | 312 } // namespace WebCore |
| OLD | NEW |