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

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

Issue 330933002: Revert of Removing "using" declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/Text.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 * (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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "platform/geometry/FloatQuad.h" 46 #include "platform/geometry/FloatQuad.h"
47 #include "wtf/RefCountedLeakCounter.h" 47 #include "wtf/RefCountedLeakCounter.h"
48 #include "wtf/text/CString.h" 48 #include "wtf/text/CString.h"
49 #include "wtf/text/StringBuilder.h" 49 #include "wtf/text/StringBuilder.h"
50 #ifndef NDEBUG 50 #ifndef NDEBUG
51 #include <stdio.h> 51 #include <stdio.h>
52 #endif 52 #endif
53 53
54 namespace WebCore { 54 namespace WebCore {
55 55
56 using namespace std;
56 using namespace HTMLNames; 57 using namespace HTMLNames;
57 58
58 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, rangeCounter, ("Range")); 59 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, rangeCounter, ("Range"));
59 60
60 inline Range::Range(Document& ownerDocument) 61 inline Range::Range(Document& ownerDocument)
61 : m_ownerDocument(&ownerDocument) 62 : m_ownerDocument(&ownerDocument)
62 , m_start(m_ownerDocument) 63 , m_start(m_ownerDocument)
63 , m_end(m_ownerDocument) 64 , m_end(m_ownerDocument)
64 { 65 {
65 #ifndef NDEBUG 66 #ifndef NDEBUG
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 String Range::toString() const 928 String Range::toString() const
928 { 929 {
929 StringBuilder builder; 930 StringBuilder builder;
930 931
931 Node* pastLast = pastLastNode(); 932 Node* pastLast = pastLastNode();
932 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { 933 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) {
933 Node::NodeType type = n->nodeType(); 934 Node::NodeType type = n->nodeType();
934 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) { 935 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) {
935 String data = toCharacterData(n)->data(); 936 String data = toCharacterData(n)->data();
936 int length = data.length(); 937 int length = data.length();
937 int start = (n == m_start.container()) ? std::min(std::max(0, m_star t.offset()), length) : 0; 938 int start = (n == m_start.container()) ? min(max(0, m_start.offset() ), length) : 0;
938 int end = (n == m_end.container()) ? std::min(std::max(start, m_end. offset()), length) : length; 939 int end = (n == m_end.container()) ? min(max(start, m_end.offset()), length) : length;
939 builder.append(data, start, end - start); 940 builder.append(data, start, end - start);
940 } 941 }
941 } 942 }
942 943
943 return builder.toString(); 944 return builder.toString();
944 } 945 }
945 946
946 String Range::toHTML() const 947 String Range::toHTML() const
947 { 948 {
948 return createMarkup(this); 949 return createMarkup(this);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 bool allFixed = true; 1333 bool allFixed = true;
1333 bool someFixed = false; 1334 bool someFixed = false;
1334 1335
1335 Node* stopNode = pastLastNode(); 1336 Node* stopNode = pastLastNode();
1336 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1337 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1337 RenderObject* r = node->renderer(); 1338 RenderObject* r = node->renderer();
1338 if (!r || !r->isText()) 1339 if (!r || !r->isText())
1339 continue; 1340 continue;
1340 RenderText* renderText = toRenderText(r); 1341 RenderText* renderText = toRenderText(r);
1341 int startOffset = node == startContainer ? m_start.offset() : 0; 1342 int startOffset = node == startContainer ? m_start.offset() : 0;
1342 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max(); 1343 int endOffset = node == endContainer ? m_end.offset() : numeric_limits<i nt>::max();
1343 bool isFixed = false; 1344 bool isFixed = false;
1344 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele ctionHeight, &isFixed); 1345 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele ctionHeight, &isFixed);
1345 allFixed &= isFixed; 1346 allFixed &= isFixed;
1346 someFixed |= isFixed; 1347 someFixed |= isFixed;
1347 } 1348 }
1348 1349
1349 if (inFixed) 1350 if (inFixed)
1350 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition); 1351 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition);
1351 } 1352 }
1352 1353
1353 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeIn FixedPosition* inFixed) const 1354 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeIn FixedPosition* inFixed) const
1354 { 1355 {
1355 Node* startContainer = m_start.container(); 1356 Node* startContainer = m_start.container();
1356 ASSERT(startContainer); 1357 ASSERT(startContainer);
1357 Node* endContainer = m_end.container(); 1358 Node* endContainer = m_end.container();
1358 ASSERT(endContainer); 1359 ASSERT(endContainer);
1359 1360
1360 bool allFixed = true; 1361 bool allFixed = true;
1361 bool someFixed = false; 1362 bool someFixed = false;
1362 1363
1363 Node* stopNode = pastLastNode(); 1364 Node* stopNode = pastLastNode();
1364 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) { 1365 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next( *node)) {
1365 RenderObject* r = node->renderer(); 1366 RenderObject* r = node->renderer();
1366 if (!r || !r->isText()) 1367 if (!r || !r->isText())
1367 continue; 1368 continue;
1368 RenderText* renderText = toRenderText(r); 1369 RenderText* renderText = toRenderText(r);
1369 int startOffset = node == startContainer ? m_start.offset() : 0; 1370 int startOffset = node == startContainer ? m_start.offset() : 0;
1370 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim its<int>::max(); 1371 int endOffset = node == endContainer ? m_end.offset() : numeric_limits<i nt>::max();
1371 bool isFixed = false; 1372 bool isFixed = false;
1372 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele ctionHeight, &isFixed); 1373 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele ctionHeight, &isFixed);
1373 allFixed &= isFixed; 1374 allFixed &= isFixed;
1374 someFixed |= isFixed; 1375 someFixed |= isFixed;
1375 } 1376 }
1376 1377
1377 if (inFixed) 1378 if (inFixed)
1378 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition); 1379 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe dPosition : NotFixedPosition);
1379 } 1380 }
1380 1381
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 1672
1672 void showTree(const WebCore::Range* range) 1673 void showTree(const WebCore::Range* range)
1673 { 1674 {
1674 if (range && range->boundaryPointsValid()) { 1675 if (range && range->boundaryPointsValid()) {
1675 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1676 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1676 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1677 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1677 } 1678 }
1678 } 1679 }
1679 1680
1680 #endif 1681 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698