Reviewed by Darin
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Sep 2004 18:24:53 +0000 (18:24 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Sep 2004 18:24:53 +0000 (18:24 +0000)
        Mark the VisiblePosition taking (Position &, EAffinity=DOWNSTREAM) explicit. Recently, when I added
        the EAffinity argument, I left this constructor implicit. Darin pointed out to me that this is
        undesirable since implicit use of the the constructor involved making the affinity choice, something
        which should be done explicitly.

        * khtml/editing/selection.cpp:
        (khtml::Selection::modifyExtendingRightForward): Make explicit use of constructor mentioned above.
        (khtml::Selection::modifyMovingRightForward): Ditto.
        (khtml::Selection::modifyExtendingLeftBackward): Ditto.
        (khtml::Selection::modifyMovingLeftBackward): Ditto.
        (khtml::Selection::modify): Ditto.
        (khtml::Selection::validate): Ditto.
        * khtml/editing/visible_position.h: Make constructor taking (Position &, EAffinity) explicit.
        * khtml/editing/visible_units.cpp: Ditto.
        (khtml::previousWordBoundary): Make explicit use of constructor mentioned above.
        (khtml::nextWordBoundary): Ditto.
        (khtml::previousLinePosition): Ditto.
        (khtml::nextLinePosition): Ditto.
        * kwq/KWQKHTMLPart.mm: Ditto.
        (KWQKHTMLPart::findString): Ditto.
        (KWQKHTMLPart::advanceToNextMisspelling): Ditto.
        (KWQKHTMLPart::markMisspellingsInSelection): Ditto.
        (KWQKHTMLPart::updateSpellChecking): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7706 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/SelectionController.cpp
WebCore/khtml/editing/selection.cpp
WebCore/khtml/editing/visible_position.h
WebCore/khtml/editing/visible_units.cpp
WebCore/kwq/KWQKHTMLPart.mm

index f6278039e910e957e6d016cb8e3d936252f779aa..66e869457548060ea79fbb25d7b3f31e5c80278e 100644 (file)
@@ -1,3 +1,31 @@
+2004-09-28  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Darin
+        
+        Mark the VisiblePosition taking (Position &, EAffinity=DOWNSTREAM) explicit. Recently, when I added
+        the EAffinity argument, I left this constructor implicit. Darin pointed out to me that this is
+        undesirable since implicit use of the the constructor involved making the affinity choice, something
+        which should be done explicitly.
+
+        * khtml/editing/selection.cpp:
+        (khtml::Selection::modifyExtendingRightForward): Make explicit use of constructor mentioned above.
+        (khtml::Selection::modifyMovingRightForward): Ditto.
+        (khtml::Selection::modifyExtendingLeftBackward): Ditto.
+        (khtml::Selection::modifyMovingLeftBackward): Ditto.
+        (khtml::Selection::modify): Ditto.
+        (khtml::Selection::validate): Ditto.
+        * khtml/editing/visible_position.h: Make constructor taking (Position &, EAffinity) explicit.
+        * khtml/editing/visible_units.cpp: Ditto.
+        (khtml::previousWordBoundary): Make explicit use of constructor mentioned above.
+        (khtml::nextWordBoundary): Ditto.
+        (khtml::previousLinePosition): Ditto.
+        (khtml::nextLinePosition): Ditto.
+        * kwq/KWQKHTMLPart.mm: Ditto.
+        (KWQKHTMLPart::findString): Ditto.
+        (KWQKHTMLPart::advanceToNextMisspelling): Ditto.
+        (KWQKHTMLPart::markMisspellingsInSelection): Ditto.
+        (KWQKHTMLPart::updateSpellChecking): Ditto.
+
 2004-09-28  Darin Adler  <darin@apple.com>
 
         Reviewed by John.
index e5d3c445e7cf7e0eb8c7439134ca5da59b2a9933..adb5ff8e5e87abfdde3ea5c27fefc8e5d0a6507e 100644 (file)
@@ -219,7 +219,7 @@ void Selection::setModifyBias(EAlter alter, EDirection direction)
 
 VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granularity)
 {
-    VisiblePosition pos = m_extent;
+    VisiblePosition pos(m_extent);
     switch (granularity) {
         case CHARACTER:
             pos = pos.next();
@@ -234,14 +234,14 @@ VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granular
             pos = nextLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_end).end();
+            pos = VisiblePosition(selectionForLine(m_end).end());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = endOfParagraph(m_end);
+            pos = endOfParagraph(VisiblePosition(m_end));
             break;
         case DOCUMENT_BOUNDARY: {
             NodeImpl *de = m_start.node()->getDocument()->documentElement();
-            pos = Position(de, de ? de->childNodeCount() : 0);
+            pos = VisiblePosition(de, de ? de->childNodeCount() : 0);
             break;
         }
     }
@@ -254,28 +254,28 @@ VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity
     switch (granularity) {
         case CHARACTER:
             if (isRange()) 
-                pos = m_end;
+                pos = VisiblePosition(m_end);
             else
                 pos = VisiblePosition(m_extent).next();
             break;
         case WORD:
-            pos = nextWordPosition(m_extent);
+            pos = nextWordPosition(VisiblePosition(m_extent));
             break;
         case PARAGRAPH:
-            pos = nextParagraphPosition(m_end, xPosForVerticalArrowNavigation(END, isRange()));
+            pos = nextParagraphPosition(VisiblePosition(m_end), xPosForVerticalArrowNavigation(END, isRange()));
             break;
         case LINE:
-            pos = nextLinePosition(m_end, xPosForVerticalArrowNavigation(END, isRange()));
+            pos = nextLinePosition(VisiblePosition(m_end), xPosForVerticalArrowNavigation(END, isRange()));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_end).end();
+            pos = VisiblePosition(selectionForLine(m_end).end());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = endOfParagraph(m_end);
+            pos = endOfParagraph(VisiblePosition(m_end));
             break;
         case DOCUMENT_BOUNDARY: {
             NodeImpl *de = m_start.node()->getDocument()->documentElement();
-            pos = Position(de, de ? de->childNodeCount() : 0);
+            pos = VisiblePosition(de, de ? de->childNodeCount() : 0);
             break;
         }
     }
@@ -284,7 +284,7 @@ VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity
 
 VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
 {
-    VisiblePosition pos = m_extent;
+    VisiblePosition pos(m_extent);
     switch (granularity) {
         case CHARACTER:
             pos = pos.previous();
@@ -299,10 +299,10 @@ VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granular
             pos = previousLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_start).start();
+            pos = VisiblePosition(selectionForLine(m_start).start());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = startOfParagraph(m_start);
+            pos = startOfParagraph(VisiblePosition(m_start));
             break;
         case DOCUMENT_BOUNDARY:
             pos = VisiblePosition(m_start.node()->getDocument()->documentElement(), 0);
@@ -317,24 +317,24 @@ VisiblePosition Selection::modifyMovingLeftBackward(ETextGranularity granularity
     switch (granularity) {
         case CHARACTER:
             if (isRange()) 
-                pos = m_start;
+                pos = VisiblePosition(m_start);
             else
                 pos = VisiblePosition(m_extent).previous();
             break;
         case WORD:
-            pos = previousWordPosition(m_extent);
+            pos = previousWordPosition(VisiblePosition(m_extent));
             break;
         case PARAGRAPH:
-            pos = previousParagraphPosition(m_start, xPosForVerticalArrowNavigation(START, isRange()));
+            pos = previousParagraphPosition(VisiblePosition(m_start), xPosForVerticalArrowNavigation(START, isRange()));
             break;
         case LINE:
-            pos = previousLinePosition(m_start, xPosForVerticalArrowNavigation(START, isRange()));
+            pos = previousLinePosition(VisiblePosition(m_start), xPosForVerticalArrowNavigation(START, isRange()));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_start).start();
+            pos = VisiblePosition(selectionForLine(m_start).start());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = startOfParagraph(m_start).deepEquivalent();
+            pos = startOfParagraph(VisiblePosition(m_start));
             break;
         case DOCUMENT_BOUNDARY:
             pos = VisiblePosition(m_start.node()->getDocument()->documentElement(), 0);
@@ -412,11 +412,11 @@ bool Selection::modify(EAlter alter, int verticalDistance)
     int xPos = 0; /* initialized only to make compiler happy */
     switch (alter) {
         case MOVE:
-            pos = verticalDistance > 0 ? m_end : m_start;
+            pos = VisiblePosition(verticalDistance > 0 ? m_end : m_start);
             xPos = xPosForVerticalArrowNavigation(verticalDistance > 0 ? END : START, isRange());
             break;
         case EXTEND:
-            pos = m_extent;
+            pos = VisiblePosition(m_extent);
             xPos = xPosForVerticalArrowNavigation(EXTENT);
             break;
     }
@@ -733,13 +733,13 @@ void Selection::validate(ETextGranularity granularity)
             break;
         case WORD:
             if (m_baseIsStart) {
-                m_end = endOfWord(m_extent).deepEquivalent();
+                m_end = endOfWord(VisiblePosition(m_extent)).deepEquivalent();
                 // If at the end of the document, expand to the left.
                 EWordSide side = (m_end == m_extent) ? LeftWordIfOnBoundary : RightWordIfOnBoundary;
-                m_start = startOfWord(m_base, side).deepEquivalent();
+                m_start = startOfWord(VisiblePosition(m_base), side).deepEquivalent();
             } else {
-                m_start = startOfWord(m_extent).deepEquivalent();
-                m_end = endOfWord(m_base).deepEquivalent();
+                m_start = startOfWord(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfWord(VisiblePosition(m_base)).deepEquivalent();
             }
             break;
         case LINE:
@@ -765,11 +765,11 @@ void Selection::validate(ETextGranularity granularity)
         }
         case PARAGRAPH:
             if (m_baseIsStart) {
-                m_start = startOfParagraph(m_base).deepEquivalent();
-                m_end = endOfParagraph(m_extent, IncludeLineBreak).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_base)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_extent), IncludeLineBreak).deepEquivalent();
             } else {
-                m_start = startOfParagraph(m_extent).deepEquivalent();
-                m_end = endOfParagraph(m_base, IncludeLineBreak).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_base), IncludeLineBreak).deepEquivalent();
             }
             break;
         case DOCUMENT_BOUNDARY: {
@@ -780,11 +780,11 @@ void Selection::validate(ETextGranularity granularity)
         }
         case PARAGRAPH_BOUNDARY:
             if (m_baseIsStart) {
-                m_start = startOfParagraph(m_base).deepEquivalent();
-                m_end = endOfParagraph(m_extent).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_base)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
             } else {
-                m_start = startOfParagraph(m_extent).deepEquivalent();
-                m_end = endOfParagraph(m_base).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_base)).deepEquivalent();
             }
             break;
     }
index e5d3c445e7cf7e0eb8c7439134ca5da59b2a9933..adb5ff8e5e87abfdde3ea5c27fefc8e5d0a6507e 100644 (file)
@@ -219,7 +219,7 @@ void Selection::setModifyBias(EAlter alter, EDirection direction)
 
 VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granularity)
 {
-    VisiblePosition pos = m_extent;
+    VisiblePosition pos(m_extent);
     switch (granularity) {
         case CHARACTER:
             pos = pos.next();
@@ -234,14 +234,14 @@ VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granular
             pos = nextLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_end).end();
+            pos = VisiblePosition(selectionForLine(m_end).end());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = endOfParagraph(m_end);
+            pos = endOfParagraph(VisiblePosition(m_end));
             break;
         case DOCUMENT_BOUNDARY: {
             NodeImpl *de = m_start.node()->getDocument()->documentElement();
-            pos = Position(de, de ? de->childNodeCount() : 0);
+            pos = VisiblePosition(de, de ? de->childNodeCount() : 0);
             break;
         }
     }
@@ -254,28 +254,28 @@ VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity
     switch (granularity) {
         case CHARACTER:
             if (isRange()) 
-                pos = m_end;
+                pos = VisiblePosition(m_end);
             else
                 pos = VisiblePosition(m_extent).next();
             break;
         case WORD:
-            pos = nextWordPosition(m_extent);
+            pos = nextWordPosition(VisiblePosition(m_extent));
             break;
         case PARAGRAPH:
-            pos = nextParagraphPosition(m_end, xPosForVerticalArrowNavigation(END, isRange()));
+            pos = nextParagraphPosition(VisiblePosition(m_end), xPosForVerticalArrowNavigation(END, isRange()));
             break;
         case LINE:
-            pos = nextLinePosition(m_end, xPosForVerticalArrowNavigation(END, isRange()));
+            pos = nextLinePosition(VisiblePosition(m_end), xPosForVerticalArrowNavigation(END, isRange()));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_end).end();
+            pos = VisiblePosition(selectionForLine(m_end).end());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = endOfParagraph(m_end);
+            pos = endOfParagraph(VisiblePosition(m_end));
             break;
         case DOCUMENT_BOUNDARY: {
             NodeImpl *de = m_start.node()->getDocument()->documentElement();
-            pos = Position(de, de ? de->childNodeCount() : 0);
+            pos = VisiblePosition(de, de ? de->childNodeCount() : 0);
             break;
         }
     }
@@ -284,7 +284,7 @@ VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity
 
 VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
 {
-    VisiblePosition pos = m_extent;
+    VisiblePosition pos(m_extent);
     switch (granularity) {
         case CHARACTER:
             pos = pos.previous();
@@ -299,10 +299,10 @@ VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granular
             pos = previousLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_start).start();
+            pos = VisiblePosition(selectionForLine(m_start).start());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = startOfParagraph(m_start);
+            pos = startOfParagraph(VisiblePosition(m_start));
             break;
         case DOCUMENT_BOUNDARY:
             pos = VisiblePosition(m_start.node()->getDocument()->documentElement(), 0);
@@ -317,24 +317,24 @@ VisiblePosition Selection::modifyMovingLeftBackward(ETextGranularity granularity
     switch (granularity) {
         case CHARACTER:
             if (isRange()) 
-                pos = m_start;
+                pos = VisiblePosition(m_start);
             else
                 pos = VisiblePosition(m_extent).previous();
             break;
         case WORD:
-            pos = previousWordPosition(m_extent);
+            pos = previousWordPosition(VisiblePosition(m_extent));
             break;
         case PARAGRAPH:
-            pos = previousParagraphPosition(m_start, xPosForVerticalArrowNavigation(START, isRange()));
+            pos = previousParagraphPosition(VisiblePosition(m_start), xPosForVerticalArrowNavigation(START, isRange()));
             break;
         case LINE:
-            pos = previousLinePosition(m_start, xPosForVerticalArrowNavigation(START, isRange()));
+            pos = previousLinePosition(VisiblePosition(m_start), xPosForVerticalArrowNavigation(START, isRange()));
             break;
         case LINE_BOUNDARY:
-            pos = selectionForLine(m_start).start();
+            pos = VisiblePosition(selectionForLine(m_start).start());
             break;
         case PARAGRAPH_BOUNDARY:
-            pos = startOfParagraph(m_start).deepEquivalent();
+            pos = startOfParagraph(VisiblePosition(m_start));
             break;
         case DOCUMENT_BOUNDARY:
             pos = VisiblePosition(m_start.node()->getDocument()->documentElement(), 0);
@@ -412,11 +412,11 @@ bool Selection::modify(EAlter alter, int verticalDistance)
     int xPos = 0; /* initialized only to make compiler happy */
     switch (alter) {
         case MOVE:
-            pos = verticalDistance > 0 ? m_end : m_start;
+            pos = VisiblePosition(verticalDistance > 0 ? m_end : m_start);
             xPos = xPosForVerticalArrowNavigation(verticalDistance > 0 ? END : START, isRange());
             break;
         case EXTEND:
-            pos = m_extent;
+            pos = VisiblePosition(m_extent);
             xPos = xPosForVerticalArrowNavigation(EXTENT);
             break;
     }
@@ -733,13 +733,13 @@ void Selection::validate(ETextGranularity granularity)
             break;
         case WORD:
             if (m_baseIsStart) {
-                m_end = endOfWord(m_extent).deepEquivalent();
+                m_end = endOfWord(VisiblePosition(m_extent)).deepEquivalent();
                 // If at the end of the document, expand to the left.
                 EWordSide side = (m_end == m_extent) ? LeftWordIfOnBoundary : RightWordIfOnBoundary;
-                m_start = startOfWord(m_base, side).deepEquivalent();
+                m_start = startOfWord(VisiblePosition(m_base), side).deepEquivalent();
             } else {
-                m_start = startOfWord(m_extent).deepEquivalent();
-                m_end = endOfWord(m_base).deepEquivalent();
+                m_start = startOfWord(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfWord(VisiblePosition(m_base)).deepEquivalent();
             }
             break;
         case LINE:
@@ -765,11 +765,11 @@ void Selection::validate(ETextGranularity granularity)
         }
         case PARAGRAPH:
             if (m_baseIsStart) {
-                m_start = startOfParagraph(m_base).deepEquivalent();
-                m_end = endOfParagraph(m_extent, IncludeLineBreak).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_base)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_extent), IncludeLineBreak).deepEquivalent();
             } else {
-                m_start = startOfParagraph(m_extent).deepEquivalent();
-                m_end = endOfParagraph(m_base, IncludeLineBreak).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_base), IncludeLineBreak).deepEquivalent();
             }
             break;
         case DOCUMENT_BOUNDARY: {
@@ -780,11 +780,11 @@ void Selection::validate(ETextGranularity granularity)
         }
         case PARAGRAPH_BOUNDARY:
             if (m_baseIsStart) {
-                m_start = startOfParagraph(m_base).deepEquivalent();
-                m_end = endOfParagraph(m_extent).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_base)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
             } else {
-                m_start = startOfParagraph(m_extent).deepEquivalent();
-                m_end = endOfParagraph(m_base).deepEquivalent();
+                m_start = startOfParagraph(VisiblePosition(m_extent)).deepEquivalent();
+                m_end = endOfParagraph(VisiblePosition(m_base)).deepEquivalent();
             }
             break;
     }
index fbb1cca01bfae2cacbf62d73b5608bdce8265f0c..2f9ccd181abbdf6de1845e076fd050204b09fb0e 100644 (file)
@@ -44,7 +44,7 @@ public:
 
     VisiblePosition() { }
     VisiblePosition(NodeImpl *, long offset, EAffinity affinity=DOWNSTREAM);
-    VisiblePosition(const Position &, EAffinity affinity=DOWNSTREAM);
+    explicit VisiblePosition(const Position &, EAffinity affinity=DOWNSTREAM);
 
     void clear() { m_deepPosition.clear(); }
 
index 8c8d673199362ba681999fd8d7337b63979cea2a..1e3a610d9a1505175beb2fa766b12d4d2df010fd 100644 (file)
@@ -108,7 +108,7 @@ static VisiblePosition previousWordBoundary(const VisiblePosition &c, unsigned (
     }
     // Use DOWNSTREAM here so that we don't jump past words at the start of lines.
     // <rdar://problem/3765519> REGRESSION (Mail): word movement goes too far upstream at start of line
-    return VisiblePosition(pos).deepEquivalent();
+    return VisiblePosition(pos);
 }
 
 static VisiblePosition nextWordBoundary(const VisiblePosition &c, unsigned (*searchFunction)(const QChar *, unsigned))
@@ -168,7 +168,7 @@ static VisiblePosition nextWordBoundary(const VisiblePosition &c, unsigned (*sea
         charIt.advance(next - 1);
         pos = Position(charIt.range().endContainer().handle(), charIt.range().endOffset());
     }
-    return VisiblePosition(pos, UPSTREAM).deepEquivalent();
+    return VisiblePosition(pos, UPSTREAM);
 }
 
 static unsigned startWordBoundary(const QChar *characters, unsigned length)
@@ -229,12 +229,12 @@ VisiblePosition nextWordPosition(const VisiblePosition &c)
 
 VisiblePosition previousLinePosition(const VisiblePosition &c, int x)
 {
-    return c.deepEquivalent().previousLinePosition(x);
+    return VisiblePosition(c.deepEquivalent().previousLinePosition(x));
 }
 
 VisiblePosition nextLinePosition(const VisiblePosition &c, int x)
 {
-    return c.deepEquivalent().nextLinePosition(x);
+    return VisiblePosition(c.deepEquivalent().nextLinePosition(x));
 }
 
 VisiblePosition startOfParagraph(const VisiblePosition &c)
index 6602f246163b0064d94276efe145d066cdb11c6e..1b6b0f7b4b77045be3e0b4e5597d50e2d431952e 100644 (file)
@@ -592,9 +592,9 @@ bool KWQKHTMLPart::findString(NSString *string, bool forward, bool caseFlag, boo
     searchRange.selectNodeContents(xmlDocImpl());
     if (selectionStart()) {
         if (forward) {
-            setStart(searchRange, selection().end());
+            setStart(searchRange, VisiblePosition(selection().end()));
         } else {
-            setEnd(searchRange, selection().start());
+            setEnd(searchRange, VisiblePosition(selection().start()));
         }
     }
 
@@ -917,7 +917,7 @@ QString KWQKHTMLPart::advanceToNextMisspelling(bool startBeforeSelection)
     if (selectionStart()) {
         startedWithSelection = true;
         if (startBeforeSelection) {
-            VisiblePosition start = selection().start();
+            VisiblePosition start(selection().start());
             // We match AppKit's rule: Start 1 character before the selection.
             VisiblePosition oneBeforeStart = start.previous();
             setStart(searchRange, oneBeforeStart.isNotNull() ? oneBeforeStart : start);
@@ -3793,7 +3793,7 @@ void KWQKHTMLPart::markMisspellingsInSelection(const Selection &selection)
     // So, for now, the idea is to mimic AppKit behavior and limit the selection to the first word 
     // of the selection passed in.
     // This is not ideal by any means, but this is the convention.
-    VisiblePosition start = selection.start();
+    VisiblePosition start(selection.start());
     Selection s(startOfWord(start, LeftWordIfOnBoundary), endOfWord(start, RightWordIfOnBoundary));
     if (!s.isRange())
         return;
@@ -3854,7 +3854,7 @@ void KWQKHTMLPart::updateSpellChecking()
         if ([_bridge isContinuousSpellCheckingEnabled]) {
             // This only erases a marker in the first word of the selection.  Perhaps peculiar, but it
             // matches AppKit.
-            VisiblePosition start = selection().start();
+            VisiblePosition start(selection().start());
             Selection s(startOfWord(start, LeftWordIfOnBoundary), endOfWord(start, RightWordIfOnBoundary));
             xmlDocImpl()->removeMarker(s.toRange(), DocumentMarker::Spelling);
         }