Attachment #623486: Patch part 2, v1 -- Remove dead code for bug #590640

View | Details | Raw Unified | Return to bug 590640
Collapse All | Expand All

(-)a/editor/libeditor/html/nsHTMLEditRules.cpp (-71 lines)
Line     Link Here 
 Lines 1266-1289   nsHTMLEditRules::WillInsert(nsISelection Link Here 
1266
  // we need to get the doc
1266
  // we need to get the doc
1267
  nsCOMPtr<nsIDOMDocument> doc = mHTMLEditor->GetDOMDocument();
1267
  nsCOMPtr<nsIDOMDocument> doc = mHTMLEditor->GetDOMDocument();
1268
  NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
1268
  NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
1269
    
1269
    
1270
  // for every property that is set, insert a new inline style node
1270
  // for every property that is set, insert a new inline style node
1271
  return CreateStyleForInsertText(aSelection, doc);
1271
  return CreateStyleForInsertText(aSelection, doc);
1272
}    
1272
}    
1273
1273
1274
#ifdef XXX_DEAD_CODE
1275
nsresult
1276
nsHTMLEditRules::DidInsert(nsISelection *aSelection, nsresult aResult)
1277
{
1278
  return nsTextEditRules::DidInsert(aSelection, aResult);
1279
}
1280
#endif
1281
1282
nsresult
1274
nsresult
1283
nsHTMLEditRules::WillInsertText(nsEditor::OperationID aAction,
1275
nsHTMLEditRules::WillInsertText(nsEditor::OperationID aAction,
1284
                                nsISelection *aSelection, 
1276
                                nsISelection *aSelection, 
1285
                                bool            *aCancel,
1277
                                bool            *aCancel,
1286
                                bool            *aHandled,
1278
                                bool            *aHandled,
1287
                                const nsAString *inString,
1279
                                const nsAString *inString,
1288
                                nsAString       *outString,
1280
                                nsAString       *outString,
1289
                                PRInt32          aMaxLength)
1281
                                PRInt32          aMaxLength)
 Lines 5232-5310   nsHTMLEditRules::ExpandSelectionForDelet Link Here 
5232
  {
5224
  {
5233
    // only expand to just before br
5225
    // only expand to just before br
5234
    res = aSelection->Extend(firstBRParent, firstBROffset);
5226
    res = aSelection->Extend(firstBRParent, firstBROffset);
5235
  }
5227
  }
5236
  
5228
  
5237
  return res;
5229
  return res;
5238
}
5230
}
5239
5231
5240
#ifdef XXX_DEAD_CODE
5241
///////////////////////////////////////////////////////////////////////////
5242
// AtStartOfBlock: is node/offset at the start of the editable material in this block?
5243
//                  
5244
bool
5245
nsHTMLEditRules::AtStartOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock)
5246
{
5247
  nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(aNode);
5248
  if (nodeAsText && aOffset) return false;  // there are chars in front of us
5249
  
5250
  nsCOMPtr<nsIDOMNode> priorNode;
5251
  nsresult  res = mHTMLEditor->GetPriorHTMLNode(aNode, aOffset, address_of(priorNode));
5252
  NS_ENSURE_SUCCESS(res, true);
5253
  NS_ENSURE_TRUE(priorNode, true);
5254
  nsCOMPtr<nsIDOMNode> blockParent = mHTMLEditor->GetBlockNodeParent(priorNode);
5255
  if (blockParent && (blockParent == aBlock)) return false;
5256
  return true;
5257
}
5258
5259
5260
///////////////////////////////////////////////////////////////////////////
5261
// AtEndOfBlock: is node/offset at the end of the editable material in this block?
5262
//                  
5263
bool
5264
nsHTMLEditRules::AtEndOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock)
5265
{
5266
  nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(aNode);
5267
  if (nodeAsText)   
5268
  {
5269
    PRUint32 strLength;
5270
    nodeAsText->GetLength(&strLength);
5271
    if ((PRInt32)strLength > aOffset) return false;  // there are chars in after us
5272
  }
5273
  nsCOMPtr<nsIDOMNode> nextNode;
5274
  nsresult  res = mHTMLEditor->GetNextHTMLNode(aNode, aOffset, address_of(nextNode));
5275
  NS_ENSURE_SUCCESS(res, true);
5276
  NS_ENSURE_TRUE(nextNode, true);
5277
  nsCOMPtr<nsIDOMNode> blockParent = mHTMLEditor->GetBlockNodeParent(nextNode);
5278
  if (blockParent && (blockParent == aBlock)) return false;
5279
  return true;
5280
}
5281
5282
5283
///////////////////////////////////////////////////////////////////////////
5284
// CreateMozDiv: makes a div with type = _moz
5285
//                       
5286
nsresult
5287
nsHTMLEditRules::CreateMozDiv(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outDiv)
5288
{
5289
  NS_ENSURE_TRUE(inParent && outDiv, NS_ERROR_NULL_POINTER);
5290
  nsAutoString divType= "div";
5291
  *outDiv = nsnull;
5292
  nsresult res = mHTMLEditor->CreateNode(divType, inParent, inOffset, getter_AddRefs(*outDiv));
5293
  NS_ENSURE_SUCCESS(res, res);
5294
  // give it special moz attr
5295
  nsCOMPtr<nsIDOMElement> mozDivElem = do_QueryInterface(*outDiv);
5296
  res = mHTMLEditor->SetAttribute(mozDivElem, "type", "_moz");
5297
  NS_ENSURE_SUCCESS(res, res);
5298
  res = AddTrailerBR(*outDiv);
5299
  return res;
5300
}
5301
#endif    
5302
5303
5232
5304
///////////////////////////////////////////////////////////////////////////
5233
///////////////////////////////////////////////////////////////////////////
5305
// NormalizeSelection:  tweak non-collapsed selections to be more "natural".
5234
// NormalizeSelection:  tweak non-collapsed selections to be more "natural".
5306
//    Idea here is to adjust selection endpoint so that they do not cross
5235
//    Idea here is to adjust selection endpoint so that they do not cross
5307
//    breaks or block boundaries unless something editable beyond that boundary
5236
//    breaks or block boundaries unless something editable beyond that boundary
5308
//    is also selected.  This adjustment makes it much easier for the various
5237
//    is also selected.  This adjustment makes it much easier for the various
5309
//    block operations to determine what nodes to act on.
5238
//    block operations to determine what nodes to act on.
5310
//                       
5239
//                       
(-)a/editor/libeditor/html/nsHTMLEditRules.h (-7 lines)
Line     Link Here 
 Lines 135-153   protected: Link Here 
135
  enum BRLocation
135
  enum BRLocation
136
  {
136
  {
137
    kBeforeBlock,
137
    kBeforeBlock,
138
    kBlockEnd
138
    kBlockEnd
139
  };
139
  };
140
140
141
  // nsHTMLEditRules implementation methods
141
  // nsHTMLEditRules implementation methods
142
  nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
142
  nsresult WillInsert(nsISelection *aSelection, bool *aCancel);
143
#ifdef XXX_DEAD_CODE
144
  nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
145
#endif
146
  nsresult WillInsertText(  nsEditor::OperationID aAction,
143
  nsresult WillInsertText(  nsEditor::OperationID aAction,
147
                            nsISelection *aSelection, 
144
                            nsISelection *aSelection, 
148
                            bool            *aCancel,
145
                            bool            *aCancel,
149
                            bool            *aHandled,
146
                            bool            *aHandled,
150
                            const nsAString *inString,
147
                            const nsAString *inString,
151
                            nsAString       *outString,
148
                            nsAString       *outString,
152
                            PRInt32          aMaxLength);
149
                            PRInt32          aMaxLength);
153
  nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
150
  nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel);
 Lines 227-246   protected: Link Here 
227
                              nsIDOMNode *aBodyNode,
224
                              nsIDOMNode *aBodyNode,
228
                              nsISelection *aSelection,
225
                              nsISelection *aSelection,
229
                              bool *aHandled);
226
                              bool *aHandled);
230
  nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere, 
227
  nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere, 
231
                               nsCOMPtr<nsIDOMNode> *outBRNode, PRInt32 aOffset=0);
228
                               nsCOMPtr<nsIDOMNode> *outBRNode, PRInt32 aOffset=0);
232
  nsresult ExpandSelectionForDeletion(nsISelection *aSelection);
229
  nsresult ExpandSelectionForDeletion(nsISelection *aSelection);
233
  bool IsFirstNode(nsIDOMNode *aNode);
230
  bool IsFirstNode(nsIDOMNode *aNode);
234
  bool IsLastNode(nsIDOMNode *aNode);
231
  bool IsLastNode(nsIDOMNode *aNode);
235
#ifdef XXX_DEAD_CODE
236
  bool AtStartOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
237
  bool AtEndOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
238
#endif
239
  nsresult NormalizeSelection(nsISelection *inSelection);
232
  nsresult NormalizeSelection(nsISelection *inSelection);
240
  nsresult GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode,
233
  nsresult GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode,
241
                            PRInt32 aOffset, nsEditor::OperationID actionID,
234
                            PRInt32 aOffset, nsEditor::OperationID actionID,
242
                            nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset);
235
                            nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset);
243
  nsresult GetPromotedRanges(nsISelection *inSelection, 
236
  nsresult GetPromotedRanges(nsISelection *inSelection, 
244
                             nsCOMArray<nsIDOMRange> &outArrayOfRanges, 
237
                             nsCOMArray<nsIDOMRange> &outArrayOfRanges, 
245
                             nsEditor::OperationID inOperationType);
238
                             nsEditor::OperationID inOperationType);
246
  nsresult PromoteRange(nsIDOMRange *inRange,
239
  nsresult PromoteRange(nsIDOMRange *inRange,

Return to bug 590640