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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (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/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 11 matching lines...) Expand all
22 #include "core/page/TouchAdjustment.h" 22 #include "core/page/TouchAdjustment.h"
23 23
24 #include "core/dom/ContainerNode.h" 24 #include "core/dom/ContainerNode.h"
25 #include "core/dom/Node.h" 25 #include "core/dom/Node.h"
26 #include "core/dom/NodeRenderStyle.h" 26 #include "core/dom/NodeRenderStyle.h"
27 #include "core/dom/Text.h" 27 #include "core/dom/Text.h"
28 #include "core/editing/Editor.h" 28 #include "core/editing/Editor.h"
29 #include "core/frame/FrameView.h" 29 #include "core/frame/FrameView.h"
30 #include "core/frame/LocalFrame.h" 30 #include "core/frame/LocalFrame.h"
31 #include "core/html/HTMLFrameOwnerElement.h" 31 #include "core/html/HTMLFrameOwnerElement.h"
32 #include "core/layout/LayoutObject.h"
32 #include "core/rendering/RenderBox.h" 33 #include "core/rendering/RenderBox.h"
33 #include "core/rendering/RenderObject.h"
34 #include "core/rendering/RenderText.h" 34 #include "core/rendering/RenderText.h"
35 #include "core/rendering/style/RenderStyle.h" 35 #include "core/rendering/style/RenderStyle.h"
36 #include "platform/geometry/FloatPoint.h" 36 #include "platform/geometry/FloatPoint.h"
37 #include "platform/geometry/FloatQuad.h" 37 #include "platform/geometry/FloatQuad.h"
38 #include "platform/geometry/IntSize.h" 38 #include "platform/geometry/IntSize.h"
39 #include "platform/text/TextBreakIterator.h" 39 #include "platform/text/TextBreakIterator.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 namespace TouchAdjustment { 43 namespace TouchAdjustment {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (node->renderer()->isImage()) 124 if (node->renderer()->isImage())
125 return true; 125 return true;
126 if (node->renderer()->isMedia()) 126 if (node->renderer()->isMedia())
127 return true; 127 return true;
128 if (node->renderer()->canBeSelectionLeaf()) { 128 if (node->renderer()->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->renderer()->frame()->editor().behavior().shouldSelectOnContext ualMenuClick())
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() != RenderObject::SelectionNone) 134 if (node->renderer()->selectionState() != LayoutObject::SelectionNone)
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)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int offset; 178 int offset;
179 while ((offset = wordIterator->next()) != -1) { 179 while ((offset = wordIterator->next()) != -1) {
180 if (isWordTextBreak(wordIterator)) { 180 if (isWordTextBreak(wordIterator)) {
181 Vector<FloatQuad> quads; 181 Vector<FloatQuad> quads;
182 textRenderer->absoluteQuadsForRange(quads, lastOffset, offset); 182 textRenderer->absoluteQuadsForRange(quads, lastOffset, offset);
183 appendQuadsToSubtargetList(quads, textNode, subtargets); 183 appendQuadsToSubtargetList(quads, textNode, subtargets);
184 } 184 }
185 lastOffset = offset; 185 lastOffset = offset;
186 } 186 }
187 } else { 187 } else {
188 if (textRenderer->selectionState() == RenderObject::SelectionNone) 188 if (textRenderer->selectionState() == LayoutObject::SelectionNone)
189 return appendBasicSubtargetsForNode(node, subtargets); 189 return appendBasicSubtargetsForNode(node, subtargets);
190 // If selected, make subtargets out of only the selected part of the tex t. 190 // If selected, make subtargets out of only the selected part of the tex t.
191 int startPos, endPos; 191 int startPos, endPos;
192 switch (textRenderer->selectionState()) { 192 switch (textRenderer->selectionState()) {
193 case RenderObject::SelectionInside: 193 case LayoutObject::SelectionInside:
194 startPos = 0; 194 startPos = 0;
195 endPos = textRenderer->textLength(); 195 endPos = textRenderer->textLength();
196 break; 196 break;
197 case RenderObject::SelectionStart: 197 case LayoutObject::SelectionStart:
198 textRenderer->selectionStartEnd(startPos, endPos); 198 textRenderer->selectionStartEnd(startPos, endPos);
199 endPos = textRenderer->textLength(); 199 endPos = textRenderer->textLength();
200 break; 200 break;
201 case RenderObject::SelectionEnd: 201 case LayoutObject::SelectionEnd:
202 textRenderer->selectionStartEnd(startPos, endPos); 202 textRenderer->selectionStartEnd(startPos, endPos);
203 startPos = 0; 203 startPos = 0;
204 break; 204 break;
205 case RenderObject::SelectionBoth: 205 case LayoutObject::SelectionBoth:
206 textRenderer->selectionStartEnd(startPos, endPos); 206 textRenderer->selectionStartEnd(startPos, endPos);
207 break; 207 break;
208 default: 208 default:
209 ASSERT_NOT_REACHED(); 209 ASSERT_NOT_REACHED();
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 }
(...skipping 291 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