summaryrefslogtreecommitdiffstats
path: root/WebCore/svg/SVGTextContentElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/svg/SVGTextContentElement.cpp')
-rw-r--r--WebCore/svg/SVGTextContentElement.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index 8b34c2c..067f35f 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -29,14 +29,15 @@
#include "FloatPoint.h"
#include "FloatRect.h"
#include "Frame.h"
+#include "MappedAttribute.h"
#include "Position.h"
#include "RenderSVGText.h"
-#include "SelectionController.h"
#include "SVGCharacterLayoutInfo.h"
-#include "SVGRootInlineBox.h"
-#include "SVGLength.h"
#include "SVGInlineTextBox.h"
+#include "SVGLength.h"
#include "SVGNames.h"
+#include "SVGRootInlineBox.h"
+#include "SelectionController.h"
#include "XMLNames.h"
#include <wtf/StdLibExtras.h>
@@ -370,7 +371,7 @@ static inline SVGInlineTextBoxQueryWalker executeTextQuery(const SVGTextContentE
return walkerCallback;
}
-long SVGTextContentElement::getNumberOfChars() const
+unsigned SVGTextContentElement::getNumberOfChars() const
{
document()->updateLayoutIgnorePendingStylesheets();
@@ -384,12 +385,12 @@ float SVGTextContentElement::getComputedTextLength() const
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::TextLength).floatResult();
}
-float SVGTextContentElement::getSubStringLength(long charnum, long nchars, ExceptionCode& ec) const
+float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionCode& ec) const
{
document()->updateLayoutIgnorePendingStylesheets();
- long numberOfChars = getNumberOfChars();
- if (charnum < 0 || nchars < 0 || charnum >= numberOfChars) {
+ unsigned numberOfChars = getNumberOfChars();
+ if (charnum >= numberOfChars) {
ec = INDEX_SIZE_ERR;
return 0.0f;
}
@@ -397,11 +398,11 @@ float SVGTextContentElement::getSubStringLength(long charnum, long nchars, Excep
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::SubStringLength, charnum, nchars).floatResult();
}
-FloatPoint SVGTextContentElement::getStartPositionOfChar(long charnum, ExceptionCode& ec) const
+FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionCode& ec) const
{
document()->updateLayoutIgnorePendingStylesheets();
- if (charnum < 0 || charnum > getNumberOfChars()) {
+ if (charnum > getNumberOfChars()) {
ec = INDEX_SIZE_ERR;
return FloatPoint();
}
@@ -409,11 +410,11 @@ FloatPoint SVGTextContentElement::getStartPositionOfChar(long charnum, Exception
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::StartPosition, charnum).pointResult();
}
-FloatPoint SVGTextContentElement::getEndPositionOfChar(long charnum, ExceptionCode& ec) const
+FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionCode& ec) const
{
document()->updateLayoutIgnorePendingStylesheets();
- if (charnum < 0 || charnum > getNumberOfChars()) {
+ if (charnum > getNumberOfChars()) {
ec = INDEX_SIZE_ERR;
return FloatPoint();
}
@@ -421,11 +422,11 @@ FloatPoint SVGTextContentElement::getEndPositionOfChar(long charnum, ExceptionCo
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::EndPosition, charnum).pointResult();
}
-FloatRect SVGTextContentElement::getExtentOfChar(long charnum, ExceptionCode& ec) const
+FloatRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionCode& ec) const
{
document()->updateLayoutIgnorePendingStylesheets();
- if (charnum < 0 || charnum > getNumberOfChars()) {
+ if (charnum > getNumberOfChars()) {
ec = INDEX_SIZE_ERR;
return FloatRect();
}
@@ -433,11 +434,11 @@ FloatRect SVGTextContentElement::getExtentOfChar(long charnum, ExceptionCode& ec
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Extent, charnum).rectResult();
}
-float SVGTextContentElement::getRotationOfChar(long charnum, ExceptionCode& ec) const
+float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionCode& ec) const
{
document()->updateLayoutIgnorePendingStylesheets();
- if (charnum < 0 || charnum > getNumberOfChars()) {
+ if (charnum > getNumberOfChars()) {
ec = INDEX_SIZE_ERR;
return 0.0f;
}
@@ -445,17 +446,17 @@ float SVGTextContentElement::getRotationOfChar(long charnum, ExceptionCode& ec)
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::Rotation, charnum).floatResult();
}
-long SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const
+int SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const
{
document()->updateLayoutIgnorePendingStylesheets();
return executeTextQuery(this, SVGInlineTextBoxQueryWalker::CharacterNumberAtPosition, 0.0f, 0.0f, point).longResult();
}
-void SVGTextContentElement::selectSubString(long charnum, long nchars, ExceptionCode& ec) const
+void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionCode& ec) const
{
- long numberOfChars = getNumberOfChars();
- if (charnum < 0 || nchars < 0 || charnum >= numberOfChars) {
+ unsigned numberOfChars = getNumberOfChars();
+ if (charnum >= numberOfChars) {
ec = INDEX_SIZE_ERR;
return;
}
@@ -472,12 +473,12 @@ void SVGTextContentElement::selectSubString(long charnum, long nchars, Exception
// Find selection start
VisiblePosition start(const_cast<SVGTextContentElement*>(this), 0, SEL_DEFAULT_AFFINITY);
- for (long i = 0; i < charnum; ++i)
+ for (unsigned i = 0; i < charnum; ++i)
start = start.next();
// Find selection end
VisiblePosition end(start);
- for (long i = 0; i < nchars; ++i)
+ for (unsigned i = 0; i < nchars; ++i)
end = end.next();
controller->setSelection(VisibleSelection(start, end));