OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/editing/TextAffinity.h" | 35 #include "core/editing/TextAffinity.h" |
36 #include "core/editing/VisiblePosition.h" | 36 #include "core/editing/VisiblePosition.h" |
37 #include "core/editing/VisibleUnits.h" | 37 #include "core/editing/VisibleUnits.h" |
38 #include "core/editing/iterators/TextIterator.h" | 38 #include "core/editing/iterators/TextIterator.h" |
39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
41 #include "core/html/HTMLTableElement.h" | 41 #include "core/html/HTMLTableElement.h" |
42 #include "core/layout/LayoutBlock.h" | 42 #include "core/layout/LayoutBlock.h" |
43 #include "core/layout/LayoutInline.h" | 43 #include "core/layout/LayoutInline.h" |
44 #include "core/layout/LayoutText.h" | 44 #include "core/layout/LayoutText.h" |
45 #include "core/layout/line/InlineIterator.h" | |
46 #include "core/layout/line/InlineTextBox.h" | 45 #include "core/layout/line/InlineTextBox.h" |
47 #include "wtf/text/CString.h" | 46 #include "wtf/text/CString.h" |
48 #include <stdio.h> | 47 #include <stdio.h> |
49 | 48 |
50 namespace blink { | 49 namespace blink { |
51 | 50 |
52 using namespace HTMLNames; | 51 using namespace HTMLNames; |
53 | 52 |
54 #if ENABLE(ASSERT) | 53 #if ENABLE(ASSERT) |
55 static bool canBeAnchorNode(Node* node) | 54 static bool canBeAnchorNode(Node* node) |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 { | 520 { |
522 return mostForwardCaretPosition(*this, rule); | 521 return mostForwardCaretPosition(*this, rule); |
523 } | 522 } |
524 | 523 |
525 template <typename Strategy> | 524 template <typename Strategy> |
526 PositionAlgorithm<Strategy> PositionAlgorithm<Strategy>::downstream(EditingBound
aryCrossingRule rule) const | 525 PositionAlgorithm<Strategy> PositionAlgorithm<Strategy>::downstream(EditingBound
aryCrossingRule rule) const |
527 { | 526 { |
528 return mostBackwardCaretPosition(*this, rule); | 527 return mostBackwardCaretPosition(*this, rule); |
529 } | 528 } |
530 | 529 |
531 static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect) | |
532 { | |
533 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); | |
534 } | |
535 | |
536 // TODO(yosin) We should move |hasRenderedNonAnonymousDescendantsWithHeight| | |
537 // to "VisibleUnits.cpp" to reduce |LayoutObject| dependency in "Position.cpp" | |
538 bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* layoutObject) | |
539 { | |
540 LayoutObject* stop = layoutObject->nextInPreOrderAfterChildren(); | |
541 for (LayoutObject *o = layoutObject->slowFirstChild(); o && o != stop; o = o
->nextInPreOrder()) { | |
542 if (o->nonPseudoNode()) { | |
543 if ((o->isText() && boundingBoxLogicalHeight(o, toLayoutText(o)->lin
esBoundingBox())) | |
544 || (o->isBox() && toLayoutBox(o)->pixelSnappedLogicalHeight()) | |
545 || (o->isLayoutInline() && isEmptyInline(LineLayoutItem(o)) && b
oundingBoxLogicalHeight(o, toLayoutInline(o)->linesBoundingBox()))) | |
546 return true; | |
547 } | |
548 } | |
549 return false; | |
550 } | |
551 | |
552 template <typename Strategy> | 530 template <typename Strategy> |
553 Node* PositionAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node) | 531 Node* PositionAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node) |
554 { | 532 { |
555 if (!node || !nodeIsUserSelectAll(node)) | 533 if (!node || !nodeIsUserSelectAll(node)) |
556 return 0; | 534 return 0; |
557 Node* parent = Strategy::parent(*node); | 535 Node* parent = Strategy::parent(*node); |
558 if (!parent) | 536 if (!parent) |
559 return node; | 537 return node; |
560 | 538 |
561 Node* candidateRoot = node; | 539 Node* candidateRoot = node; |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 | 1047 |
1070 void showTree(const blink::Position* pos) | 1048 void showTree(const blink::Position* pos) |
1071 { | 1049 { |
1072 if (pos) | 1050 if (pos) |
1073 pos->showTreeForThis(); | 1051 pos->showTreeForThis(); |
1074 else | 1052 else |
1075 fprintf(stderr, "Cannot showTree for (nil)\n"); | 1053 fprintf(stderr, "Cannot showTree for (nil)\n"); |
1076 } | 1054 } |
1077 | 1055 |
1078 #endif | 1056 #endif |
OLD | NEW |