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

Side by Side Diff: sky/engine/core/dom/Range.cpp

Issue 686653002: Remove a bunch of fixed position dead code. (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
« no previous file with comments | « sky/engine/core/dom/Range.h ('k') | sky/engine/core/page/scrolling/ScrollingConstraints.h » ('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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no)
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
5 * (C) 2001 Peter Kelly (pmk@post.com) 5 * (C) 2001 Peter Kelly (pmk@post.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 { 1200 {
1201 IntRect result; 1201 IntRect result;
1202 Vector<IntRect> rects; 1202 Vector<IntRect> rects;
1203 textRects(rects); 1203 textRects(rects);
1204 const size_t n = rects.size(); 1204 const size_t n = rects.size();
1205 for (size_t i = 0; i < n; ++i) 1205 for (size_t i = 0; i < n; ++i)
1206 result.unite(rects[i]); 1206 result.unite(rects[i]);
1207 return result; 1207 return result;
1208 } 1208 }
1209 1209
1210 void Range::textRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFi xedPosition* inFixed) const 1210 void Range::textRects(Vector<IntRect>& rects, bool useSelectionHeight) const
1211 { 1211 {
1212 Node* startContainer = m_start.container(); 1212 Node* startContainer = m_start.container();
1213 ASSERT(startContainer); 1213 ASSERT(startContainer);
1214 Node* endContainer = m_end.container(); 1214 Node* endContainer = m_end.container();
1215 ASSERT(endContainer); 1215 ASSERT(endContainer);
1216 1216
1217 bool allFixed = true;
1218 bool someFixed = false;
1219
1220 Node* stopNode = pastLastNode(); 1217 Node* stopNode = pastLastNode();
1221 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1218 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1222 RenderObject* r = node->renderer(); 1219 RenderObject* r = node->renderer();
1223 if (!r || !r->isText()) 1220 if (!r || !r->isText())
1224 continue; 1221 continue;
1225 RenderText* renderText = toRenderText(r); 1222 RenderText* renderText = toRenderText(r);
1226 int startOffset = node == startContainer ? m_start.offset() : 0; 1223 int startOffset = node == startContainer ? m_start.offset() : 0;
1227 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max(); 1224 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max();
1228 bool isFixed = false; 1225 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele ctionHeight);
1229 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele ctionHeight, &isFixed);
1230 allFixed &= isFixed;
1231 someFixed |= isFixed;
1232 } 1226 }
1233
1234 if (inFixed)
1235 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition);
1236 } 1227 }
1237 1228
1238 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeIn FixedPosition* inFixed) const 1229 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight) const
1239 { 1230 {
1240 Node* startContainer = m_start.container(); 1231 Node* startContainer = m_start.container();
1241 ASSERT(startContainer); 1232 ASSERT(startContainer);
1242 Node* endContainer = m_end.container(); 1233 Node* endContainer = m_end.container();
1243 ASSERT(endContainer); 1234 ASSERT(endContainer);
1244 1235
1245 bool allFixed = true;
1246 bool someFixed = false;
1247
1248 Node* stopNode = pastLastNode(); 1236 Node* stopNode = pastLastNode();
1249 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1237 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1250 RenderObject* r = node->renderer(); 1238 RenderObject* r = node->renderer();
1251 if (!r || !r->isText()) 1239 if (!r || !r->isText())
1252 continue; 1240 continue;
1253 RenderText* renderText = toRenderText(r); 1241 RenderText* renderText = toRenderText(r);
1254 int startOffset = node == startContainer ? m_start.offset() : 0; 1242 int startOffset = node == startContainer ? m_start.offset() : 0;
1255 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max(); 1243 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max();
1256 bool isFixed = false; 1244 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele ctionHeight);
1257 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele ctionHeight, &isFixed);
1258 allFixed &= isFixed;
1259 someFixed |= isFixed;
1260 } 1245 }
1261
1262 if (inFixed)
1263 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition);
1264 } 1246 }
1265 1247
1266 #ifndef NDEBUG 1248 #ifndef NDEBUG
1267 void Range::formatForDebugger(char* buffer, unsigned length) const 1249 void Range::formatForDebugger(char* buffer, unsigned length) const
1268 { 1250 {
1269 StringBuilder result; 1251 StringBuilder result;
1270 1252
1271 const int FormatBufferSize = 1024; 1253 const int FormatBufferSize = 1024;
1272 char s[FormatBufferSize]; 1254 char s[FormatBufferSize];
1273 result.appendLiteral("from offset "); 1255 result.appendLiteral("from offset ");
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1549
1568 void showTree(const blink::Range* range) 1550 void showTree(const blink::Range* range)
1569 { 1551 {
1570 if (range && range->boundaryPointsValid()) { 1552 if (range && range->boundaryPointsValid()) {
1571 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1553 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1572 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1554 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1573 } 1555 }
1574 } 1556 }
1575 1557
1576 #endif 1558 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Range.h ('k') | sky/engine/core/page/scrolling/ScrollingConstraints.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698