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

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

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using namespace HTMLNames; 52 using namespace HTMLNames;
53 53
54 static Node* nextRenderedEditable(Node* node) 54 static Node* nextRenderedEditable(Node* node)
55 { 55 {
56 for (node = node->nextLeafNode(); node; node = node->nextLeafNode()) { 56 for (node = node->nextLeafNode(); node; node = node->nextLeafNode()) {
57 LayoutObject* renderer = node->renderer(); 57 LayoutObject* renderer = node->renderer();
58 if (!renderer) 58 if (!renderer)
59 continue; 59 continue;
60 if (!node->hasEditableStyle()) 60 if (!node->hasEditableStyle())
61 continue; 61 continue;
62 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) 62 if ((renderer->isBox() && toLayoutBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
63 return node; 63 return node;
64 } 64 }
65 return 0; 65 return 0;
66 } 66 }
67 67
68 static Node* previousRenderedEditable(Node* node) 68 static Node* previousRenderedEditable(Node* node)
69 { 69 {
70 for (node = node->previousLeafNode(); node; node = node->previousLeafNode()) { 70 for (node = node->previousLeafNode(); node; node = node->previousLeafNode()) {
71 LayoutObject* renderer = node->renderer(); 71 LayoutObject* renderer = node->renderer();
72 if (!renderer) 72 if (!renderer)
73 continue; 73 continue;
74 if (!node->hasEditableStyle()) 74 if (!node->hasEditableStyle())
75 continue; 75 continue;
76 if ((renderer->isBox() && toRenderBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox())) 76 if ((renderer->isBox() && toLayoutBox(renderer)->inlineBoxWrapper()) || (renderer->isText() && toRenderText(renderer)->firstTextBox()))
77 return node; 77 return node;
78 } 78 }
79 return 0; 79 return 0;
80 } 80 }
81 81
82 const TreeScope* Position::commonAncestorTreeScope(const Position& a, const Posi tion& b) 82 const TreeScope* Position::commonAncestorTreeScope(const Position& a, const Posi tion& b)
83 { 83 {
84 if (!a.containerNode() || !b.containerNode()) 84 if (!a.containerNode() || !b.containerNode())
85 return nullptr; 85 return nullptr;
86 return a.containerNode()->treeScope().commonAncestorTreeScope(b.containerNod e()->treeScope()); 86 return a.containerNode()->treeScope().commonAncestorTreeScope(b.containerNod e()->treeScope());
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Don't include inline tables. 497 // Don't include inline tables.
498 if (isHTMLTableElement(*node)) 498 if (isHTMLTableElement(*node))
499 return false; 499 return false;
500 500
501 // A Marquee elements are moving so we should assume their ends are always 501 // A Marquee elements are moving so we should assume their ends are always
502 // visibily distinct. 502 // visibily distinct.
503 if (isHTMLMarqueeElement(*node)) 503 if (isHTMLMarqueeElement(*node))
504 return true; 504 return true;
505 505
506 // There is a VisiblePosition inside an empty inline-block container. 506 // There is a VisiblePosition inside an empty inline-block container.
507 return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && toRenderBox(node->renderer())->size().height() != 0 && !node->hasChildren(); 507 return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && toLayoutBox(node->renderer())->size().height() != 0 && !node->hasChildren();
508 } 508 }
509 509
510 static Node* enclosingVisualBoundary(Node* node) 510 static Node* enclosingVisualBoundary(Node* node)
511 { 511 {
512 while (node && !endsOfNodeAreVisuallyDistinctPositions(node)) 512 while (node && !endsOfNodeAreVisuallyDistinctPositions(node))
513 node = node->parentNode(); 513 node = node->parentNode();
514 514
515 return node; 515 return node;
516 } 516 }
517 517
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 { 778 {
779 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); 779 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width();
780 } 780 }
781 781
782 bool Position::hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* render er) 782 bool Position::hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* render er)
783 { 783 {
784 LayoutObject* stop = renderer->nextInPreOrderAfterChildren(); 784 LayoutObject* stop = renderer->nextInPreOrderAfterChildren();
785 for (LayoutObject *o = renderer->slowFirstChild(); o && o != stop; o = o->ne xtInPreOrder()) 785 for (LayoutObject *o = renderer->slowFirstChild(); o && o != stop; o = o->ne xtInPreOrder())
786 if (o->nonPseudoNode()) { 786 if (o->nonPseudoNode()) {
787 if ((o->isText() && boundingBoxLogicalHeight(o, toRenderText(o)->lin esBoundingBox())) 787 if ((o->isText() && boundingBoxLogicalHeight(o, toRenderText(o)->lin esBoundingBox()))
788 || (o->isBox() && toRenderBox(o)->pixelSnappedLogicalHeight()) 788 || (o->isBox() && toLayoutBox(o)->pixelSnappedLogicalHeight())
789 || (o->isRenderInline() && isEmptyInline(o) && boundingBoxLogica lHeight(o, toRenderInline(o)->linesBoundingBox()))) 789 || (o->isRenderInline() && isEmptyInline(o) && boundingBoxLogica lHeight(o, toRenderInline(o)->linesBoundingBox())))
790 return true; 790 return true;
791 } 791 }
792 return false; 792 return false;
793 } 793 }
794 794
795 bool Position::nodeIsUserSelectNone(Node* node) 795 bool Position::nodeIsUserSelectNone(Node* node)
796 { 796 {
797 return node && node->renderer() && !node->renderer()->isSelectable(); 797 return node && node->renderer() && !node->renderer()->isSelectable();
798 } 798 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 if (equivalent == *this) { 1081 if (equivalent == *this) {
1082 equivalent = upstreamIgnoringEditingBoundaries(*this); 1082 equivalent = upstreamIgnoringEditingBoundaries(*this);
1083 if (equivalent == *this || downstreamIgnoringEditingBoundaries(e quivalent) == *this) 1083 if (equivalent == *this || downstreamIgnoringEditingBoundaries(e quivalent) == *this)
1084 return; 1084 return;
1085 } 1085 }
1086 1086
1087 equivalent.getInlineBoxAndOffset(UPSTREAM, primaryDirection, inlineB ox, caretOffset); 1087 equivalent.getInlineBoxAndOffset(UPSTREAM, primaryDirection, inlineB ox, caretOffset);
1088 return; 1088 return;
1089 } 1089 }
1090 if (renderer->isBox()) { 1090 if (renderer->isBox()) {
1091 inlineBox = toRenderBox(renderer)->inlineBoxWrapper(); 1091 inlineBox = toLayoutBox(renderer)->inlineBoxWrapper();
1092 if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && care tOffset < inlineBox->caretMaxOffset())) 1092 if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && care tOffset < inlineBox->caretMaxOffset()))
1093 return; 1093 return;
1094 } 1094 }
1095 } else { 1095 } else {
1096 RenderText* textRenderer = toRenderText(renderer); 1096 RenderText* textRenderer = toRenderText(renderer);
1097 1097
1098 InlineTextBox* box; 1098 InlineTextBox* box;
1099 InlineTextBox* candidate = 0; 1099 InlineTextBox* candidate = 0;
1100 1100
1101 for (box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) { 1101 for (box = textRenderer->firstTextBox(); box; box = box->nextTextBox()) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 pos.showTreeForThis(); 1313 pos.showTreeForThis();
1314 } 1314 }
1315 1315
1316 void showTree(const blink::Position* pos) 1316 void showTree(const blink::Position* pos)
1317 { 1317 {
1318 if (pos) 1318 if (pos)
1319 pos->showTreeForThis(); 1319 pos->showTreeForThis();
1320 } 1320 }
1321 1321
1322 #endif 1322 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698