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

Side by Side Diff: Source/core/page/TouchAdjustment.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/SpatialNavigation.cpp ('k') | Source/core/page/TouchDisambiguation.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) 2012 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return true; 99 return true;
100 } 100 }
101 return false; 101 return false;
102 } 102 }
103 103
104 bool nodeIsZoomTarget(Node* node) 104 bool nodeIsZoomTarget(Node* node)
105 { 105 {
106 if (node->isTextNode() || node->isShadowRoot()) 106 if (node->isTextNode() || node->isShadowRoot())
107 return false; 107 return false;
108 108
109 ASSERT(node->renderer()); 109 ASSERT(node->layoutObject());
110 return node->renderer()->isBox(); 110 return node->layoutObject()->isBox();
111 } 111 }
112 112
113 bool providesContextMenuItems(Node* node) 113 bool providesContextMenuItems(Node* node)
114 { 114 {
115 // This function tries to match the nodes that receive special context-menu items in 115 // This function tries to match the nodes that receive special context-menu items in
116 // ContextMenuController::populate(), and should be kept uptodate with those . 116 // ContextMenuController::populate(), and should be kept uptodate with those .
117 ASSERT(node->renderer() || node->isShadowRoot()); 117 ASSERT(node->layoutObject() || node->isShadowRoot());
118 if (!node->renderer()) 118 if (!node->layoutObject())
119 return false; 119 return false;
120 if (node->isContentEditable()) 120 if (node->isContentEditable())
121 return true; 121 return true;
122 if (node->isLink()) 122 if (node->isLink())
123 return true; 123 return true;
124 if (node->renderer()->isImage()) 124 if (node->layoutObject()->isImage())
125 return true; 125 return true;
126 if (node->renderer()->isMedia()) 126 if (node->layoutObject()->isMedia())
127 return true; 127 return true;
128 if (node->renderer()->canBeSelectionLeaf()) { 128 if (node->layoutObject()->canBeSelectionLeaf()) {
129 // If the context menu gesture will trigger a selection all selectable n odes are valid targets. 129 // If the context menu gesture will trigger a selection all selectable n odes are valid targets.
130 if (node->renderer()->frame()->editor().behavior().shouldSelectOnContext ualMenuClick()) 130 if (node->layoutObject()->frame()->editor().behavior().shouldSelectOnCon textualMenuClick())
131 return true; 131 return true;
132 // Only the selected part of the renderer is a valid target, but this wi ll be corrected in 132 // Only the selected part of the renderer is a valid target, but this wi ll be corrected in
133 // appendContextSubtargetsForNode. 133 // appendContextSubtargetsForNode.
134 if (node->renderer()->selectionState() != LayoutObject::SelectionNone) 134 if (node->layoutObject()->selectionState() != LayoutObject::SelectionNon e)
135 return true; 135 return true;
136 } 136 }
137 return false; 137 return false;
138 } 138 }
139 139
140 static inline void appendQuadsToSubtargetList(Vector<FloatQuad>& quads, Node* no de, SubtargetGeometryList& subtargets) 140 static inline void appendQuadsToSubtargetList(Vector<FloatQuad>& quads, Node* no de, SubtargetGeometryList& subtargets)
141 { 141 {
142 Vector<FloatQuad>::const_iterator it = quads.begin(); 142 Vector<FloatQuad>::const_iterator it = quads.begin();
143 const Vector<FloatQuad>::const_iterator end = quads.end(); 143 const Vector<FloatQuad>::const_iterator end = quads.end();
144 for (; it != end; ++it) 144 for (; it != end; ++it)
145 subtargets.append(SubtargetGeometry(node, *it)); 145 subtargets.append(SubtargetGeometry(node, *it));
146 } 146 }
147 147
148 static inline void appendBasicSubtargetsForNode(Node* node, SubtargetGeometryLis t& subtargets) 148 static inline void appendBasicSubtargetsForNode(Node* node, SubtargetGeometryLis t& subtargets)
149 { 149 {
150 // Node guaranteed to have renderer due to check in node filter. 150 // Node guaranteed to have renderer due to check in node filter.
151 ASSERT(node->renderer()); 151 ASSERT(node->layoutObject());
152 152
153 Vector<FloatQuad> quads; 153 Vector<FloatQuad> quads;
154 node->renderer()->absoluteQuads(quads); 154 node->layoutObject()->absoluteQuads(quads);
155 155
156 appendQuadsToSubtargetList(quads, node, subtargets); 156 appendQuadsToSubtargetList(quads, node, subtargets);
157 } 157 }
158 158
159 static inline void appendContextSubtargetsForNode(Node* node, SubtargetGeometryL ist& subtargets) 159 static inline void appendContextSubtargetsForNode(Node* node, SubtargetGeometryL ist& subtargets)
160 { 160 {
161 // This is a variant of appendBasicSubtargetsForNode that adds special subta rgets for 161 // This is a variant of appendBasicSubtargetsForNode that adds special subta rgets for
162 // selected or auto-selectable parts of text nodes. 162 // selected or auto-selectable parts of text nodes.
163 ASSERT(node->renderer()); 163 ASSERT(node->layoutObject());
164 164
165 if (!node->isTextNode()) 165 if (!node->isTextNode())
166 return appendBasicSubtargetsForNode(node, subtargets); 166 return appendBasicSubtargetsForNode(node, subtargets);
167 167
168 Text* textNode = toText(node); 168 Text* textNode = toText(node);
169 LayoutText* textRenderer = textNode->renderer(); 169 LayoutText* textRenderer = textNode->layoutObject();
170 170
171 if (textRenderer->frame()->editor().behavior().shouldSelectOnContextualMenuC lick()) { 171 if (textRenderer->frame()->editor().behavior().shouldSelectOnContextualMenuC lick()) {
172 // Make subtargets out of every word. 172 // Make subtargets out of every word.
173 String textValue = textNode->data(); 173 String textValue = textNode->data();
174 TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textVa lue.length()); 174 TextBreakIterator* wordIterator = wordBreakIterator(textValue, 0, textVa lue.length());
175 int lastOffset = wordIterator->first(); 175 int lastOffset = wordIterator->first();
176 if (lastOffset == -1) 176 if (lastOffset == -1)
177 return; 177 return;
178 int offset; 178 int offset;
179 while ((offset = wordIterator->next()) != -1) { 179 while ((offset = wordIterator->next()) != -1) {
(...skipping 30 matching lines...) Expand all
210 return; 210 return;
211 } 211 }
212 Vector<FloatQuad> quads; 212 Vector<FloatQuad> quads;
213 textRenderer->absoluteQuadsForRange(quads, startPos, endPos); 213 textRenderer->absoluteQuadsForRange(quads, startPos, endPos);
214 appendQuadsToSubtargetList(quads, textNode, subtargets); 214 appendQuadsToSubtargetList(quads, textNode, subtargets);
215 } 215 }
216 } 216 }
217 217
218 static inline void appendZoomableSubtargets(Node* node, SubtargetGeometryList& s ubtargets) 218 static inline void appendZoomableSubtargets(Node* node, SubtargetGeometryList& s ubtargets)
219 { 219 {
220 LayoutBox* renderer = toLayoutBox(node->renderer()); 220 LayoutBox* renderer = toLayoutBox(node->layoutObject());
221 ASSERT(renderer); 221 ASSERT(renderer);
222 222
223 Vector<FloatQuad> quads; 223 Vector<FloatQuad> quads;
224 FloatRect borderBoxRect = renderer->borderBoxRect(); 224 FloatRect borderBoxRect = renderer->borderBoxRect();
225 FloatRect contentBoxRect = renderer->contentBoxRect(); 225 FloatRect contentBoxRect = renderer->contentBoxRect();
226 quads.append(renderer->localToAbsoluteQuad(borderBoxRect)); 226 quads.append(renderer->localToAbsoluteQuad(borderBoxRect));
227 if (borderBoxRect != contentBoxRect) 227 if (borderBoxRect != contentBoxRect)
228 quads.append(renderer->localToAbsoluteQuad(contentBoxRect)); 228 quads.append(renderer->localToAbsoluteQuad(contentBoxRect));
229 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for f loats. 229 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for f loats.
230 230
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 507
508 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint & touchHotspot, const IntRect& touchArea, const WillBeHeapVector<RefPtrWillBeMem ber<Node>>& nodes) 508 bool findBestZoomableArea(Node*& targetNode, IntRect& targetArea, const IntPoint & touchHotspot, const IntRect& touchArea, const WillBeHeapVector<RefPtrWillBeMem ber<Node>>& nodes)
509 { 509 {
510 IntPoint targetPoint; 510 IntPoint targetPoint;
511 TouchAdjustment::SubtargetGeometryList subtargets; 511 TouchAdjustment::SubtargetGeometryList subtargets;
512 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); 512 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets);
513 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable IntersectionQuotient); 513 return TouchAdjustment::findNodeWithLowestDistanceMetric(targetNode, targetP oint, targetArea, touchHotspot, touchArea, subtargets, TouchAdjustment::zoomable IntersectionQuotient);
514 } 514 }
515 515
516 } // namespace blink 516 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/SpatialNavigation.cpp ('k') | Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698