2006-03-01 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Mar 2006 02:00:04 +0000 (02:00 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Mar 2006 02:00:04 +0000 (02:00 +0000)
        Reviewed by justing.

       Update ESelectionGranulartiy enum to use newer CamelCase styling.

        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge alterCurrentSelection:direction:granularity:]):
        * editing/Selection.cpp:
        (WebCore::Selection::Selection):
        (WebCore::Selection::validate):
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::modifyExtendingRightForward):
        (WebCore::SelectionController::modifyMovingRightForward):
        (WebCore::SelectionController::modifyExtendingLeftBackward):
        (WebCore::SelectionController::modifyMovingLeftBackward):
        (WebCore::SelectionController::modify):
        * editing/TypingCommand.cpp:
        (WebCore::TypingCommand::deleteKeyPressed):
        (WebCore::TypingCommand::forwardDeleteKeyPressed):
        * editing/jsediting.cpp:
        * editing/text_granularity.h:
        (WebCore::):
        * page/Frame.cpp:
        (WebCore::Frame::selectClosestWordFromMouseEvent):
        (WebCore::Frame::handleMousePressEventTripleClick):
        (WebCore::Frame::handleMousePressEventSingleClick):
        (WebCore::Frame::handleMouseMoveEventSelection):

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

WebCore/ChangeLog
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/editing/Selection.cpp
WebCore/editing/SelectionController.cpp
WebCore/editing/TypingCommand.cpp
WebCore/editing/jsediting.cpp
WebCore/editing/text_granularity.h
WebCore/page/Frame.cpp

index c02c748..c5563e6 100644 (file)
@@ -1,3 +1,32 @@
+2006-03-01  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by justing.
+
+       Update ESelectionGranulartiy enum to use newer CamelCase styling.
+
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge alterCurrentSelection:direction:granularity:]):
+        * editing/Selection.cpp:
+        (WebCore::Selection::Selection):
+        (WebCore::Selection::validate):
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::modifyExtendingRightForward):
+        (WebCore::SelectionController::modifyMovingRightForward):
+        (WebCore::SelectionController::modifyExtendingLeftBackward):
+        (WebCore::SelectionController::modifyMovingLeftBackward):
+        (WebCore::SelectionController::modify):
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::deleteKeyPressed):
+        (WebCore::TypingCommand::forwardDeleteKeyPressed):
+        * editing/jsediting.cpp:
+        * editing/text_granularity.h:
+        (WebCore::):
+        * page/Frame.cpp:
+        (WebCore::Frame::selectClosestWordFromMouseEvent):
+        (WebCore::Frame::handleMousePressEventTripleClick):
+        (WebCore::Frame::handleMousePressEventSingleClick):
+        (WebCore::Frame::handleMouseMoveEventSelection):
+
 2006-03-01  Alexander Kellett  <lypanov@kde.org>
 
         Reviewed by Maciej.
index ebff35d..8ab4127 100644 (file)
@@ -1767,7 +1767,7 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     // to preserve smart delete behavior when extending by word.  e.g. double-click,
     // then shift-option-rightarrow, then delete needs to smart delete, per TextEdit.
     if (!((alteration == WebSelectByExtending) &&
-          (granularity == WebBridgeSelectByWord) && (m_frame->selectionGranularity() == WORD)))
+          (granularity == WebBridgeSelectByWord) && (m_frame->selectionGranularity() == WordGranularity)))
         m_frame->setSelectionGranularity(static_cast<ETextGranularity>(WebBridgeSelectByCharacter));
     
     // restore vertical navigation x position if necessary
index aaf1534..058113c 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
 
 Selection::Selection()
     : m_affinity(DOWNSTREAM)
-    , m_granularity(CHARACTER)
+    , m_granularity(CharacterGranularity)
     , m_state(NONE)
     , m_baseIsFirst(true)
 {
@@ -46,7 +46,7 @@ Selection::Selection()
 Selection::Selection(const Position &pos, EAffinity affinity)
     : m_base(pos), m_extent(pos)
     , m_affinity(affinity)
-    , m_granularity(CHARACTER)
+    , m_granularity(CharacterGranularity)
     , m_state(NONE)
     , m_baseIsFirst(true)
 {
@@ -56,7 +56,7 @@ Selection::Selection(const Position &pos, EAffinity affinity)
 Selection::Selection(const Position &base, const Position &extent, EAffinity affinity)
     : m_base(base), m_extent(extent)
     , m_affinity(affinity)
-    , m_granularity(CHARACTER)
+    , m_granularity(CharacterGranularity)
     , m_state(NONE)
     , m_baseIsFirst(true)
 {
@@ -184,10 +184,10 @@ void Selection::validate()
     
     // Expand the selection if requested.
     switch (m_granularity) {
-        case CHARACTER:
+        case CharacterGranularity:
             // Don't do any expansion.
             break;
-        case WORD: {
+        case WordGranularity: {
             // General case: Select the word the caret is positioned inside of, or at the start of (RightWordIfOnBoundary).
             // Edge case: If the caret is after the last word in a soft-wrapped line or the last word in
             // the document, select that last word (LeftWordIfOnBoundary).
@@ -206,7 +206,7 @@ void Selection::validate()
             
             break;
             }
-        case LINE: {
+        case LineGranularity: {
             m_start = startOfLine(VisiblePosition(m_start, m_affinity)).deepEquivalent();
             VisiblePosition end = endOfLine(VisiblePosition(m_end, m_affinity));
             // If the end of this line is at the end of a paragraph, include the space 
@@ -224,7 +224,7 @@ void Selection::validate()
             m_end = endOfLine(VisiblePosition(m_end, m_affinity)).deepEquivalent();
             break;
         }
-        case PARAGRAPH: {
+        case ParagraphGranularity: {
             VisiblePosition pos(m_start, m_affinity);
             if (isStartOfLine(pos) && isEndOfDocument(pos))
                 pos = pos.previous();
index ecf5107..0a463c4 100644 (file)
@@ -281,22 +281,22 @@ VisiblePosition SelectionController::modifyExtendingRightForward(ETextGranularit
 {
     VisiblePosition pos(m_sel.extent(), m_sel.affinity());
     switch (granularity) {
-        case CHARACTER:
+        case CharacterGranularity:
             if (isLastVisiblePositionBeforeTableElement(pos.deepEquivalent()))
                 pos = VisiblePosition(positionAfterFollowingTableElement(pos.deepEquivalent()), VP_DEFAULT_AFFINITY);
             else
                 pos = pos.next();
             break;
-        case WORD:
+        case WordGranularity:
             if (isLastVisiblePositionBeforeTableElement(pos.deepEquivalent()))
                 pos = VisiblePosition(positionAfterFollowingTableElement(pos.deepEquivalent()), VP_DEFAULT_AFFINITY);
             else
                 pos = nextWordPosition(pos);
             break;
-        case PARAGRAPH:
+        case ParagraphGranularity:
             pos = nextParagraphPosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
-        case LINE:
+        case LineGranularity:
             pos = nextLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
@@ -317,19 +317,19 @@ VisiblePosition SelectionController::modifyMovingRightForward(ETextGranularity g
 {
     VisiblePosition pos;
     switch (granularity) {
-        case CHARACTER:
+        case CharacterGranularity:
             if (isRange()) 
                 pos = VisiblePosition(m_sel.end(), m_sel.affinity());
             else
                 pos = VisiblePosition(m_sel.extent(), m_sel.affinity()).next();
             break;
-        case WORD:
+        case WordGranularity:
             pos = nextWordPosition(VisiblePosition(m_sel.extent(), m_sel.affinity()));
             break;
-        case PARAGRAPH:
+        case ParagraphGranularity:
             pos = nextParagraphPosition(VisiblePosition(m_sel.end(), m_sel.affinity()), xPosForVerticalArrowNavigation(END, isRange()));
             break;
-        case LINE: {
+        case LineGranularity: {
             // down-arrowing from a range selection that ends at the start of a line needs
             // to leave the selection at that line start (no need to call nextLinePosition!)
             pos = VisiblePosition(m_sel.end(), m_sel.affinity());
@@ -359,22 +359,22 @@ VisiblePosition SelectionController::modifyExtendingLeftBackward(ETextGranularit
     // It was done here instead of in VisiblePosition because we want VPs to iterate
     // over everything.
     switch (granularity) {
-        case CHARACTER:
+        case CharacterGranularity:
             if (isFirstVisiblePositionAfterTableElement(pos.deepEquivalent()))
                 pos = VisiblePosition(positionBeforePrecedingTableElement(pos.deepEquivalent()), VP_DEFAULT_AFFINITY);
             else
                 pos = pos.previous();
             break;
-        case WORD:
+        case WordGranularity:
             if (isFirstVisiblePositionAfterTableElement(pos.deepEquivalent()))
                 pos = VisiblePosition(positionBeforePrecedingTableElement(pos.deepEquivalent()), VP_DEFAULT_AFFINITY);
             else
                 pos = previousWordPosition(pos);
             break;
-        case PARAGRAPH:
+        case ParagraphGranularity:
             pos = previousParagraphPosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
-        case LINE:
+        case LineGranularity:
             pos = previousLinePosition(pos, xPosForVerticalArrowNavigation(EXTENT));
             break;
         case LINE_BOUNDARY:
@@ -394,19 +394,19 @@ VisiblePosition SelectionController::modifyMovingLeftBackward(ETextGranularity g
 {
     VisiblePosition pos;
     switch (granularity) {
-        case CHARACTER:
+        case CharacterGranularity:
             if (isRange()) 
                 pos = VisiblePosition(m_sel.start(), m_sel.affinity());
             else
                 pos = VisiblePosition(m_sel.extent(), m_sel.affinity()).previous();
             break;
-        case WORD:
+        case WordGranularity:
             pos = previousWordPosition(VisiblePosition(m_sel.extent(), m_sel.affinity()));
             break;
-        case PARAGRAPH:
+        case ParagraphGranularity:
             pos = previousParagraphPosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START, isRange()));
             break;
-        case LINE:
+        case LineGranularity:
             pos = previousLinePosition(VisiblePosition(m_sel.start(), m_sel.affinity()), xPosForVerticalArrowNavigation(START, isRange()));
             break;
         case LINE_BOUNDARY:
@@ -449,13 +449,13 @@ bool SelectionController::modify(const DOMString &alterString, const DOMString &
     DOMString granularityStringLower = granularityString.lower();
     ETextGranularity granularity;
     if (granularityStringLower == "character")
-        granularity = CHARACTER;
+        granularity = CharacterGranularity;
     else if (granularityStringLower == "word")
-        granularity = WORD;
+        granularity = WordGranularity;
     else if (granularityStringLower == "line")
-        granularity = LINE;
+        granularity = LineGranularity;
     else if (granularityStringLower == "paragraph")
-        granularity = PARAGRAPH;
+        granularity = ParagraphGranularity;
     else
         return false;
                 
index 33a38a3..85aa7fd 100644 (file)
@@ -316,7 +316,7 @@ void TypingCommand::deleteKeyPressed()
             // Do nothing in the case that the caret is at the start of a
             // root editable element or at the start of a document.
             SelectionController sc = SelectionController(endingSelection().start(), endingSelection().end(), SEL_DEFAULT_AFFINITY);
-            sc.modify(SelectionController::EXTEND, SelectionController::BACKWARD, CHARACTER);
+            sc.modify(SelectionController::EXTEND, SelectionController::BACKWARD, CharacterGranularity);
             selectionToDelete = sc.selection();
             break;
         }
@@ -345,7 +345,7 @@ void TypingCommand::forwardDeleteKeyPressed()
             // Do nothing in the case that the caret is at the start of a
             // root editable element or at the start of a document.
             SelectionController sc = SelectionController(endingSelection().start(), endingSelection().end(), SEL_DEFAULT_AFFINITY);
-            sc.modify(SelectionController::EXTEND, SelectionController::FORWARD, CHARACTER);
+            sc.modify(SelectionController::EXTEND, SelectionController::FORWARD, CharacterGranularity);
             selectionToDelete = sc.selection();
             break;
         }
index 6aa8371..e6aaad3 100644 (file)
@@ -204,7 +204,7 @@ bool execCut(Frame *frame, bool userInterface, const DOMString &value)
 
 bool execDelete(Frame *frame, bool userInterface, const DOMString &value)
 {
-    TypingCommand::deleteKeyPressed(frame->document(), frame->selectionGranularity() == khtml::WORD);
+    TypingCommand::deleteKeyPressed(frame->document(), frame->selectionGranularity() == WordGranularity);
     return true;
 }
 
index 5f051cc..1e3a34a 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef KHTML_EDITING_TEXT_GRANULARITY_H
-#define KHTML_EDITING_TEXT_GRANULARITY_H
+#ifndef EDITING_TEXT_GRANULARITY_H
+#define EDITING_TEXT_GRANULARITY_H
 
-namespace khtml {
+namespace WebCore {
 
 // FIXME: This really should be broken up into more than one concept.
 // Frame doesn't neeed the 3 boundaries in this enum.
-enum ETextGranularity { CHARACTER, WORD, LINE, PARAGRAPH, LINE_BOUNDARY, PARAGRAPH_BOUNDARY, DOCUMENT_BOUNDARY };
+enum ETextGranularity {
+    CharacterGranularity,
+    WordGranularity,
+    LineGranularity,
+    ParagraphGranularity,
+    LINE_BOUNDARY,
+    PARAGRAPH_BOUNDARY,
+    DOCUMENT_BOUNDARY
+};
 
 }
 
index 5580f3c..c1f768e 100644 (file)
@@ -1741,12 +1741,12 @@ void Frame::selectClosestWordFromMouseEvent(MouseEvent *mouse, NodeImpl *innerNo
         VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
         if (pos.isNotNull()) {
             selection.moveTo(pos);
-            selection.expandUsingGranularity(WORD);
+            selection.expandUsingGranularity(WordGranularity);
         }
     }
     
     if (selection.isRange()) {
-        d->m_selectionGranularity = WORD;
+        d->m_selectionGranularity = WordGranularity;
         d->m_beganSelectingText = true;
     }
     
@@ -1785,10 +1785,10 @@ void Frame::handleMousePressEventTripleClick(MouseEventWithHitTestResults* event
         VisiblePosition pos(innerNode->renderer()->positionForCoordinates(x, y));
         if (pos.isNotNull()) {
             selection.moveTo(pos);
-            selection.expandUsingGranularity(PARAGRAPH);
+            selection.expandUsingGranularity(ParagraphGranularity);
         }
         if (selection.isRange()) {
-            d->m_selectionGranularity = PARAGRAPH;
+            d->m_selectionGranularity = ParagraphGranularity;
             d->m_beganSelectingText = true;
         }
         
@@ -1836,13 +1836,13 @@ void Frame::handleMousePressEventSingleClick(MouseEventWithHitTestResults* event
                     sel.setBaseAndExtent(start.node(), start.offset(), pos.node(), pos.offset());
                 }
 
-                if (d->m_selectionGranularity != CHARACTER) {
+                if (d->m_selectionGranularity != CharacterGranularity) {
                     sel.expandUsingGranularity(d->m_selectionGranularity);
                 }
                 d->m_beganSelectingText = true;
             } else {
                 sel = SelectionController(visiblePos);
-                d->m_selectionGranularity = CHARACTER;
+                d->m_selectionGranularity = CharacterGranularity;
             }
             
             if (shouldChangeSelection(sel))
@@ -1915,7 +1915,7 @@ void Frame::handleMouseMoveEventSelection(MouseEventWithHitTestResults* event)
     }
 
     sel.setExtent(pos);
-    if (d->m_selectionGranularity != CHARACTER)
+    if (d->m_selectionGranularity != CharacterGranularity)
         sel.expandUsingGranularity(d->m_selectionGranularity);
 
     if (shouldChangeSelection(sel))