Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: sky/engine/core/editing/VisibleUnits.cpp

Issue 735193002: Remove lots of things from RenderObject (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 const InlineTextBox* previousBox = leafBoxes.previousTextBox(&startBox->root (), textBox); 208 const InlineTextBox* previousBox = leafBoxes.previousTextBox(&startBox->root (), textBox);
209 if (previousBox) 209 if (previousBox)
210 return previousBox; 210 return previousBox;
211 211
212 previousBox = leafBoxes.previousTextBox(startBox->root().prevRootBox(), 0); 212 previousBox = leafBoxes.previousTextBox(startBox->root().prevRootBox(), 0);
213 if (previousBox) 213 if (previousBox)
214 return previousBox; 214 return previousBox;
215 215
216 while (1) { 216 while (1) {
217 Node* startNode = startBox->renderer().nonPseudoNode(); 217 Node* startNode = startBox->renderer().node();
218 if (!startNode) 218 if (!startNode)
219 break; 219 break;
220 220
221 Position position = previousRootInlineBoxCandidatePosition(startNode, vi siblePosition, ContentIsEditable); 221 Position position = previousRootInlineBoxCandidatePosition(startNode, vi siblePosition, ContentIsEditable);
222 if (position.isNull()) 222 if (position.isNull())
223 break; 223 break;
224 224
225 RenderedPosition renderedPosition(position, DOWNSTREAM); 225 RenderedPosition renderedPosition(position, DOWNSTREAM);
226 RootInlineBox* previousRoot = renderedPosition.rootBox(); 226 RootInlineBox* previousRoot = renderedPosition.rootBox();
227 if (!previousRoot) 227 if (!previousRoot)
(...skipping 20 matching lines...) Expand all
248 248
249 const InlineTextBox* nextBox = leafBoxes.nextTextBox(&startBox->root(), text Box); 249 const InlineTextBox* nextBox = leafBoxes.nextTextBox(&startBox->root(), text Box);
250 if (nextBox) 250 if (nextBox)
251 return nextBox; 251 return nextBox;
252 252
253 nextBox = leafBoxes.nextTextBox(startBox->root().nextRootBox(), 0); 253 nextBox = leafBoxes.nextTextBox(startBox->root().nextRootBox(), 0);
254 if (nextBox) 254 if (nextBox)
255 return nextBox; 255 return nextBox;
256 256
257 while (1) { 257 while (1) {
258 Node* startNode =startBox->renderer().nonPseudoNode(); 258 Node* startNode =startBox->renderer().node();
259 if (!startNode) 259 if (!startNode)
260 break; 260 break;
261 261
262 Position position = nextRootInlineBoxCandidatePosition(startNode, visibl ePosition, ContentIsEditable); 262 Position position = nextRootInlineBoxCandidatePosition(startNode, visibl ePosition, ContentIsEditable);
263 if (position.isNull()) 263 if (position.isNull())
264 break; 264 break;
265 265
266 RenderedPosition renderedPosition(position, DOWNSTREAM); 266 RenderedPosition renderedPosition(position, DOWNSTREAM);
267 RootInlineBox* nextRoot = renderedPosition.rootBox(); 267 RootInlineBox* nextRoot = renderedPosition.rootBox();
268 if (!nextRoot) 268 if (!nextRoot)
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 if (!startNode) 709 if (!startNode)
710 return VisiblePosition(); 710 return VisiblePosition();
711 } else { 711 } else {
712 // Generated content (e.g. list markers and CSS :before and :after pseud oelements) have no corresponding DOM element, 712 // Generated content (e.g. list markers and CSS :before and :after pseud oelements) have no corresponding DOM element,
713 // and so cannot be represented by a VisiblePosition. Use whatever follo ws instead. 713 // and so cannot be represented by a VisiblePosition. Use whatever follo ws instead.
714 startBox = rootBox->firstLeafChild(); 714 startBox = rootBox->firstLeafChild();
715 while (true) { 715 while (true) {
716 if (!startBox) 716 if (!startBox)
717 return VisiblePosition(); 717 return VisiblePosition();
718 718
719 startNode = startBox->renderer().nonPseudoNode(); 719 startNode = startBox->renderer().node();
720 if (startNode) 720 if (startNode)
721 break; 721 break;
722 722
723 startBox = startBox->nextLeafChild(); 723 startBox = startBox->nextLeafChild();
724 } 724 }
725 } 725 }
726 726
727 return VisiblePosition(startNode->isTextNode() ? Position(toText(startNode), toInlineTextBox(startBox)->start()) : positionBeforeNode(startNode)); 727 return VisiblePosition(startNode->isTextNode() ? Position(toText(startNode), toInlineTextBox(startBox)->start()) : positionBeforeNode(startNode));
728 } 728 }
729 729
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 if (!endNode) 776 if (!endNode)
777 return VisiblePosition(); 777 return VisiblePosition();
778 } else { 778 } else {
779 // Generated content (e.g. list markers and CSS :before and :after pseud oelements) have no corresponding DOM element, 779 // Generated content (e.g. list markers and CSS :before and :after pseud oelements) have no corresponding DOM element,
780 // and so cannot be represented by a VisiblePosition. Use whatever prece des instead. 780 // and so cannot be represented by a VisiblePosition. Use whatever prece des instead.
781 endBox = rootBox->lastLeafChild(); 781 endBox = rootBox->lastLeafChild();
782 while (true) { 782 while (true) {
783 if (!endBox) 783 if (!endBox)
784 return VisiblePosition(); 784 return VisiblePosition();
785 785
786 endNode = endBox->renderer().nonPseudoNode(); 786 endNode = endBox->renderer().node();
787 if (endNode) 787 if (endNode)
788 break; 788 break;
789 789
790 endBox = endBox->prevLeafChild(); 790 endBox = endBox->prevLeafChild();
791 } 791 }
792 } 792 }
793 793
794 Position pos; 794 Position pos;
795 if (endBox->isInlineTextBox() && endNode->isTextNode()) { 795 if (endBox->isInlineTextBox() && endNode->isTextNode()) {
796 InlineTextBox* endTextBox = toInlineTextBox(endBox); 796 InlineTextBox* endTextBox = toInlineTextBox(endBox);
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 int caretOffset; 1372 int caretOffset;
1373 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca retOffset); 1373 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca retOffset);
1374 1374
1375 if (inlineBox) 1375 if (inlineBox)
1376 renderer = &inlineBox->renderer(); 1376 renderer = &inlineBox->renderer();
1377 1377
1378 return renderer->localCaretRect(inlineBox, caretOffset); 1378 return renderer->localCaretRect(inlineBox, caretOffset);
1379 } 1379 }
1380 1380
1381 } 1381 }
OLDNEW
« no previous file with comments | « sky/engine/core/editing/TextIterator.cpp ('k') | sky/engine/core/inspector/InspectorTraceEvents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698