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

Side by Side Diff: Source/core/dom/Position.cpp

Issue 184023003: Make InlineBox::renderer() and related subclass methods return reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months 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, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 // The text continues on the next line only if the last text box is not on this line and 671 // The text continues on the next line only if the last text box is not on this line and
672 // none of the boxes on this line have a larger start offset. 672 // none of the boxes on this line have a larger start offset.
673 673
674 bool continuesOnNextLine = true; 674 bool continuesOnNextLine = true;
675 InlineBox* otherBox = box; 675 InlineBox* otherBox = box;
676 while (continuesOnNextLine) { 676 while (continuesOnNextLine) {
677 otherBox = otherBox->nextLeafChild(); 677 otherBox = otherBox->nextLeafChild();
678 if (!otherBox) 678 if (!otherBox)
679 break; 679 break;
680 if (otherBox == lastTextBox || (otherBox->renderer() == text Renderer && toInlineTextBox(otherBox)->start() > textOffset)) 680 if (otherBox == lastTextBox || (&otherBox->renderer() == tex tRenderer && toInlineTextBox(otherBox)->start() > textOffset))
681 continuesOnNextLine = false; 681 continuesOnNextLine = false;
682 } 682 }
683 683
684 otherBox = box; 684 otherBox = box;
685 while (continuesOnNextLine) { 685 while (continuesOnNextLine) {
686 otherBox = otherBox->prevLeafChild(); 686 otherBox = otherBox->prevLeafChild();
687 if (!otherBox) 687 if (!otherBox)
688 break; 688 break;
689 if (otherBox == lastTextBox || (otherBox->renderer() == text Renderer && toInlineTextBox(otherBox)->start() > textOffset)) 689 if (otherBox == lastTextBox || (&otherBox->renderer() == tex tRenderer && toInlineTextBox(otherBox)->start() > textOffset))
690 continuesOnNextLine = false; 690 continuesOnNextLine = false;
691 } 691 }
692 692
693 if (continuesOnNextLine) 693 if (continuesOnNextLine)
694 return currentPos; 694 return currentPos;
695 } 695 }
696 } 696 }
697 } 697 }
698 698
699 return lastVisible; 699 return lastVisible;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 794
795 // The text continues on the next line only if the last text box is not on this line and 795 // The text continues on the next line only if the last text box is not on this line and
796 // none of the boxes on this line have a larger start offset. 796 // none of the boxes on this line have a larger start offset.
797 797
798 bool continuesOnNextLine = true; 798 bool continuesOnNextLine = true;
799 InlineBox* otherBox = box; 799 InlineBox* otherBox = box;
800 while (continuesOnNextLine) { 800 while (continuesOnNextLine) {
801 otherBox = otherBox->nextLeafChild(); 801 otherBox = otherBox->nextLeafChild();
802 if (!otherBox) 802 if (!otherBox)
803 break; 803 break;
804 if (otherBox == lastTextBox || (otherBox->renderer() == text Renderer && toInlineTextBox(otherBox)->start() >= textOffset)) 804 if (otherBox == lastTextBox || (&otherBox->renderer() == tex tRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
805 continuesOnNextLine = false; 805 continuesOnNextLine = false;
806 } 806 }
807 807
808 otherBox = box; 808 otherBox = box;
809 while (continuesOnNextLine) { 809 while (continuesOnNextLine) {
810 otherBox = otherBox->prevLeafChild(); 810 otherBox = otherBox->prevLeafChild();
811 if (!otherBox) 811 if (!otherBox)
812 break; 812 break;
813 if (otherBox == lastTextBox || (otherBox->renderer() == text Renderer && toInlineTextBox(otherBox)->start() >= textOffset)) 813 if (otherBox == lastTextBox || (&otherBox->renderer() == tex tRenderer && toInlineTextBox(otherBox)->start() >= textOffset))
814 continuesOnNextLine = false; 814 continuesOnNextLine = false;
815 } 815 }
816 816
817 if (continuesOnNextLine) 817 if (continuesOnNextLine)
818 return currentPos; 818 return currentPos;
819 } 819 }
820 } 820 }
821 } 821 }
822 822
823 return lastVisible; 823 return lastVisible;
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 pos.showTreeForThis(); 1387 pos.showTreeForThis();
1388 } 1388 }
1389 1389
1390 void showTree(const WebCore::Position* pos) 1390 void showTree(const WebCore::Position* pos)
1391 { 1391 {
1392 if (pos) 1392 if (pos)
1393 pos->showTreeForThis(); 1393 pos->showTreeForThis();
1394 } 1394 }
1395 1395
1396 #endif 1396 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/RenderedPosition.cpp » ('j') | Source/core/editing/VisibleUnits.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698