OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 #include "core/dom/ProcessingInstruction.h" | 36 #include "core/dom/ProcessingInstruction.h" |
37 #include "core/dom/Text.h" | 37 #include "core/dom/Text.h" |
38 #include "core/editing/VisiblePosition.h" | 38 #include "core/editing/VisiblePosition.h" |
39 #include "core/editing/VisibleUnits.h" | 39 #include "core/editing/VisibleUnits.h" |
40 #include "core/editing/iterators/TextIterator.h" | 40 #include "core/editing/iterators/TextIterator.h" |
41 #include "core/editing/markup.h" | 41 #include "core/editing/markup.h" |
42 #include "core/events/ScopedEventQueue.h" | 42 #include "core/events/ScopedEventQueue.h" |
43 #include "core/html/HTMLBodyElement.h" | 43 #include "core/html/HTMLBodyElement.h" |
44 #include "core/html/HTMLElement.h" | 44 #include "core/html/HTMLElement.h" |
45 #include "core/layout/LayoutBoxModelObject.h" | 45 #include "core/layout/LayoutBoxModelObject.h" |
46 #include "core/rendering/RenderText.h" | 46 #include "core/layout/LayoutText.h" |
47 #include "core/svg/SVGSVGElement.h" | 47 #include "core/svg/SVGSVGElement.h" |
48 #include "platform/geometry/FloatQuad.h" | 48 #include "platform/geometry/FloatQuad.h" |
49 #include "wtf/RefCountedLeakCounter.h" | 49 #include "wtf/RefCountedLeakCounter.h" |
50 #include "wtf/text/CString.h" | 50 #include "wtf/text/CString.h" |
51 #include "wtf/text/StringBuilder.h" | 51 #include "wtf/text/StringBuilder.h" |
52 #ifndef NDEBUG | 52 #ifndef NDEBUG |
53 #include <stdio.h> | 53 #include <stdio.h> |
54 #endif | 54 #endif |
55 | 55 |
56 namespace blink { | 56 namespace blink { |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1426 ASSERT(endContainer); | 1426 ASSERT(endContainer); |
1427 | 1427 |
1428 bool allFixed = true; | 1428 bool allFixed = true; |
1429 bool someFixed = false; | 1429 bool someFixed = false; |
1430 | 1430 |
1431 Node* stopNode = pastLastNode(); | 1431 Node* stopNode = pastLastNode(); |
1432 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(
*node)) { | 1432 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(
*node)) { |
1433 LayoutObject* r = node->renderer(); | 1433 LayoutObject* r = node->renderer(); |
1434 if (!r || !r->isText()) | 1434 if (!r || !r->isText()) |
1435 continue; | 1435 continue; |
1436 RenderText* renderText = toRenderText(r); | 1436 LayoutText* renderText = toLayoutText(r); |
1437 int startOffset = node == startContainer ? m_start.offset() : 0; | 1437 int startOffset = node == startContainer ? m_start.offset() : 0; |
1438 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim
its<int>::max(); | 1438 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim
its<int>::max(); |
1439 bool isFixed = false; | 1439 bool isFixed = false; |
1440 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele
ctionHeight, &isFixed); | 1440 renderText->absoluteRectsForRange(rects, startOffset, endOffset, useSele
ctionHeight, &isFixed); |
1441 allFixed &= isFixed; | 1441 allFixed &= isFixed; |
1442 someFixed |= isFixed; | 1442 someFixed |= isFixed; |
1443 } | 1443 } |
1444 | 1444 |
1445 if (inFixed) | 1445 if (inFixed) |
1446 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe
dPosition : NotFixedPosition); | 1446 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe
dPosition : NotFixedPosition); |
1447 } | 1447 } |
1448 | 1448 |
1449 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeIn
FixedPosition* inFixed) const | 1449 void Range::textQuads(Vector<FloatQuad>& quads, bool useSelectionHeight, RangeIn
FixedPosition* inFixed) const |
1450 { | 1450 { |
1451 Node* startContainer = m_start.container(); | 1451 Node* startContainer = m_start.container(); |
1452 ASSERT(startContainer); | 1452 ASSERT(startContainer); |
1453 Node* endContainer = m_end.container(); | 1453 Node* endContainer = m_end.container(); |
1454 ASSERT(endContainer); | 1454 ASSERT(endContainer); |
1455 | 1455 |
1456 bool allFixed = true; | 1456 bool allFixed = true; |
1457 bool someFixed = false; | 1457 bool someFixed = false; |
1458 | 1458 |
1459 Node* stopNode = pastLastNode(); | 1459 Node* stopNode = pastLastNode(); |
1460 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(
*node)) { | 1460 for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(
*node)) { |
1461 LayoutObject* r = node->renderer(); | 1461 LayoutObject* r = node->renderer(); |
1462 if (!r || !r->isText()) | 1462 if (!r || !r->isText()) |
1463 continue; | 1463 continue; |
1464 RenderText* renderText = toRenderText(r); | 1464 LayoutText* renderText = toLayoutText(r); |
1465 int startOffset = node == startContainer ? m_start.offset() : 0; | 1465 int startOffset = node == startContainer ? m_start.offset() : 0; |
1466 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim
its<int>::max(); | 1466 int endOffset = node == endContainer ? m_end.offset() : std::numeric_lim
its<int>::max(); |
1467 bool isFixed = false; | 1467 bool isFixed = false; |
1468 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele
ctionHeight, &isFixed); | 1468 renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSele
ctionHeight, &isFixed); |
1469 allFixed &= isFixed; | 1469 allFixed &= isFixed; |
1470 someFixed |= isFixed; | 1470 someFixed |= isFixed; |
1471 } | 1471 } |
1472 | 1472 |
1473 if (inFixed) | 1473 if (inFixed) |
1474 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe
dPosition : NotFixedPosition); | 1474 *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixe
dPosition : NotFixedPosition); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 if (!nodeSet.contains(node->parentNode())) { | 1728 if (!nodeSet.contains(node->parentNode())) { |
1729 if (LayoutBoxModelObject* layoutBoxModelObject = toElement(node)
->layoutBoxModelObject()) { | 1729 if (LayoutBoxModelObject* layoutBoxModelObject = toElement(node)
->layoutBoxModelObject()) { |
1730 Vector<FloatQuad> elementQuads; | 1730 Vector<FloatQuad> elementQuads; |
1731 layoutBoxModelObject->absoluteQuads(elementQuads); | 1731 layoutBoxModelObject->absoluteQuads(elementQuads); |
1732 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(el
ementQuads, *layoutBoxModelObject); | 1732 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(el
ementQuads, *layoutBoxModelObject); |
1733 | 1733 |
1734 quads.appendVector(elementQuads); | 1734 quads.appendVector(elementQuads); |
1735 } | 1735 } |
1736 } | 1736 } |
1737 } else if (node->isTextNode()) { | 1737 } else if (node->isTextNode()) { |
1738 if (RenderText* renderText = toText(node)->renderer()) { | 1738 if (LayoutText* renderText = toText(node)->renderer()) { |
1739 int startOffset = (node == startContainer) ? m_start.offset() :
0; | 1739 int startOffset = (node == startContainer) ? m_start.offset() :
0; |
1740 int endOffset = (node == endContainer) ? m_end.offset() : INT_MA
X; | 1740 int endOffset = (node == endContainer) ? m_end.offset() : INT_MA
X; |
1741 | 1741 |
1742 Vector<FloatQuad> textQuads; | 1742 Vector<FloatQuad> textQuads; |
1743 renderText->absoluteQuadsForRange(textQuads, startOffset, endOff
set); | 1743 renderText->absoluteQuadsForRange(textQuads, startOffset, endOff
set); |
1744 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(textQu
ads, *renderText); | 1744 m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(textQu
ads, *renderText); |
1745 | 1745 |
1746 quads.appendVector(textQuads); | 1746 quads.appendVector(textQuads); |
1747 } | 1747 } |
1748 } | 1748 } |
(...skipping 27 matching lines...) Expand all Loading... |
1776 | 1776 |
1777 void showTree(const blink::Range* range) | 1777 void showTree(const blink::Range* range) |
1778 { | 1778 { |
1779 if (range && range->boundaryPointsValid()) { | 1779 if (range && range->boundaryPointsValid()) { |
1780 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1780 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1781 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1781 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1782 } | 1782 } |
1783 } | 1783 } |
1784 | 1784 |
1785 #endif | 1785 #endif |
OLD | NEW |