OLD | NEW |
1 /** | 1 /** |
2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "core/rendering/svg/RenderSVGInlineText.h" | 37 #include "core/rendering/svg/RenderSVGInlineText.h" |
38 #include "core/rendering/svg/RenderSVGResource.h" | 38 #include "core/rendering/svg/RenderSVGResource.h" |
39 #include "core/rendering/svg/RenderSVGResourceSolidColor.h" | 39 #include "core/rendering/svg/RenderSVGResourceSolidColor.h" |
40 #include "core/rendering/svg/SVGResourcesCache.h" | 40 #include "core/rendering/svg/SVGResourcesCache.h" |
41 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 41 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
42 #include "platform/FloatConversion.h" | 42 #include "platform/FloatConversion.h" |
43 #include "platform/fonts/FontCache.h" | 43 #include "platform/fonts/FontCache.h" |
44 #include "platform/graphics/DrawLooperBuilder.h" | 44 #include "platform/graphics/DrawLooperBuilder.h" |
45 #include "platform/graphics/GraphicsContextStateSaver.h" | 45 #include "platform/graphics/GraphicsContextStateSaver.h" |
46 | 46 |
47 using namespace std; | |
48 | |
49 namespace WebCore { | 47 namespace WebCore { |
50 | 48 |
51 struct ExpectedSVGInlineTextBoxSize : public InlineTextBox { | 49 struct ExpectedSVGInlineTextBoxSize : public InlineTextBox { |
52 float float1; | 50 float float1; |
53 uint32_t bitfields : 1; | 51 uint32_t bitfields : 1; |
54 void* pointer; | 52 void* pointer; |
55 Vector<SVGTextFragment> vector; | 53 Vector<SVGTextFragment> vector; |
56 }; | 54 }; |
57 | 55 |
58 COMPILE_ASSERT(sizeof(SVGInlineTextBox) == sizeof(ExpectedSVGInlineTextBoxSize),
SVGInlineTextBox_is_not_of_expected_size); | 56 COMPILE_ASSERT(sizeof(SVGInlineTextBox) == sizeof(ExpectedSVGInlineTextBoxSize),
SVGInlineTextBox_is_not_of_expected_size); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (scalingFactor == 1) | 138 if (scalingFactor == 1) |
141 return selectionRect; | 139 return selectionRect; |
142 | 140 |
143 selectionRect.scale(1 / scalingFactor); | 141 selectionRect.scale(1 / scalingFactor); |
144 return selectionRect; | 142 return selectionRect; |
145 } | 143 } |
146 | 144 |
147 LayoutRect SVGInlineTextBox::localSelectionRect(int startPosition, int endPositi
on) | 145 LayoutRect SVGInlineTextBox::localSelectionRect(int startPosition, int endPositi
on) |
148 { | 146 { |
149 int boxStart = start(); | 147 int boxStart = start(); |
150 startPosition = max(startPosition - boxStart, 0); | 148 startPosition = std::max(startPosition - boxStart, 0); |
151 endPosition = min(endPosition - boxStart, static_cast<int>(len())); | 149 endPosition = std::min(endPosition - boxStart, static_cast<int>(len())); |
152 if (startPosition >= endPosition) | 150 if (startPosition >= endPosition) |
153 return LayoutRect(); | 151 return LayoutRect(); |
154 | 152 |
155 RenderStyle* style = textRenderer().style(); | 153 RenderStyle* style = textRenderer().style(); |
156 ASSERT(style); | 154 ASSERT(style); |
157 | 155 |
158 AffineTransform fragmentTransform; | 156 AffineTransform fragmentTransform; |
159 FloatRect selectionRect; | 157 FloatRect selectionRect; |
160 int fragmentStartPosition = 0; | 158 int fragmentStartPosition = 0; |
161 int fragmentEndPosition = 0; | 159 int fragmentEndPosition = 0; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(this->textRenderer
()); | 719 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(this->textRenderer
()); |
722 | 720 |
723 FloatRect markerRect; | 721 FloatRect markerRect; |
724 AffineTransform fragmentTransform; | 722 AffineTransform fragmentTransform; |
725 for (InlineTextBox* box = textRenderer.firstTextBox(); box; box = box->nextT
extBox()) { | 723 for (InlineTextBox* box = textRenderer.firstTextBox(); box; box = box->nextT
extBox()) { |
726 if (!box->isSVGInlineTextBox()) | 724 if (!box->isSVGInlineTextBox()) |
727 continue; | 725 continue; |
728 | 726 |
729 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); | 727 SVGInlineTextBox* textBox = toSVGInlineTextBox(box); |
730 | 728 |
731 int markerStartPosition = max<int>(marker->startOffset() - textBox->star
t(), 0); | 729 int markerStartPosition = std::max<int>(marker->startOffset() - textBox-
>start(), 0); |
732 int markerEndPosition = min<int>(marker->endOffset() - textBox->start(),
textBox->len()); | 730 int markerEndPosition = std::min<int>(marker->endOffset() - textBox->sta
rt(), textBox->len()); |
733 | 731 |
734 if (markerStartPosition >= markerEndPosition) | 732 if (markerStartPosition >= markerEndPosition) |
735 continue; | 733 continue; |
736 | 734 |
737 const Vector<SVGTextFragment>& fragments = textBox->textFragments(); | 735 const Vector<SVGTextFragment>& fragments = textBox->textFragments(); |
738 unsigned textFragmentsSize = fragments.size(); | 736 unsigned textFragmentsSize = fragments.size(); |
739 for (unsigned i = 0; i < textFragmentsSize; ++i) { | 737 for (unsigned i = 0; i < textFragmentsSize; ++i) { |
740 const SVGTextFragment& fragment = fragments.at(i); | 738 const SVGTextFragment& fragment = fragments.at(i); |
741 | 739 |
742 int fragmentStartPosition = markerStartPosition; | 740 int fragmentStartPosition = markerStartPosition; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 renderer().updateHitTestResult(result, locationInContainer.point
() - toLayoutSize(accumulatedOffset)); | 808 renderer().updateHitTestResult(result, locationInContainer.point
() - toLayoutSize(accumulatedOffset)); |
811 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ
est, locationInContainer, rect)) | 809 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ
est, locationInContainer, rect)) |
812 return true; | 810 return true; |
813 } | 811 } |
814 } | 812 } |
815 } | 813 } |
816 return false; | 814 return false; |
817 } | 815 } |
818 | 816 |
819 } // namespace WebCore | 817 } // namespace WebCore |
OLD | NEW |