OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
31 #include "core/css/resolver/StyleResolver.h" | 31 #include "core/css/resolver/StyleResolver.h" |
32 #include "core/dom/AXObjectCache.h" | 32 #include "core/dom/AXObjectCache.h" |
33 #include "core/dom/ElementTraversal.h" | 33 #include "core/dom/ElementTraversal.h" |
34 #include "core/dom/StyleEngine.h" | 34 #include "core/dom/StyleEngine.h" |
35 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
36 #include "core/editing/EditingBoundary.h" | 36 #include "core/editing/EditingBoundary.h" |
37 #include "core/editing/EditingUtilities.h" | 37 #include "core/editing/EditingUtilities.h" |
38 #include "core/editing/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
| 39 #include "core/editing/TextAffinity.h" |
39 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 40 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
40 #include "core/fetch/ResourceLoader.h" | 41 #include "core/fetch/ResourceLoader.h" |
41 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" | 42 #include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h" |
42 #include "core/frame/EventHandlerRegistry.h" | 43 #include "core/frame/EventHandlerRegistry.h" |
43 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
44 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
45 #include "core/frame/Settings.h" | 46 #include "core/frame/Settings.h" |
46 #include "core/frame/UseCounter.h" | 47 #include "core/frame/UseCounter.h" |
47 #include "core/html/HTMLAnchorElement.h" | 48 #include "core/html/HTMLAnchorElement.h" |
48 #include "core/html/HTMLElement.h" | 49 #include "core/html/HTMLElement.h" |
(...skipping 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 break; | 2978 break; |
2978 | 2979 |
2979 // Webkit specific extension where offsetParent stops at zoom level chan
ges. | 2980 // Webkit specific extension where offsetParent stops at zoom level chan
ges. |
2980 if (effectiveZoom != ancestor->style()->effectiveZoom()) | 2981 if (effectiveZoom != ancestor->style()->effectiveZoom()) |
2981 break; | 2982 break; |
2982 } | 2983 } |
2983 | 2984 |
2984 return node && node->isElementNode() ? toElement(node) : nullptr; | 2985 return node && node->isElementNode() ? toElement(node) : nullptr; |
2985 } | 2986 } |
2986 | 2987 |
2987 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, EAffin
ity affinity) | 2988 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf
finity affinity) |
2988 { | 2989 { |
2989 // If this is a non-anonymous layoutObject in an editable area, then it's si
mple. | 2990 // If this is a non-anonymous layoutObject in an editable area, then it's si
mple. |
2990 if (Node* node = nonPseudoNode()) { | 2991 if (Node* node = nonPseudoNode()) { |
2991 if (!node->hasEditableStyle()) { | 2992 if (!node->hasEditableStyle()) { |
2992 // If it can be found, we prefer a visually equivalent position that
is editable. | 2993 // If it can be found, we prefer a visually equivalent position that
is editable. |
2993 const Position position = Position(node, offset); | 2994 const Position position = Position(node, offset); |
2994 Position candidate = position.downstream(CanCrossEditingBoundary); | 2995 Position candidate = position.downstream(CanCrossEditingBoundary); |
2995 if (candidate.anchorNode()->hasEditableStyle()) | 2996 if (candidate.anchorNode()->hasEditableStyle()) |
2996 return PositionWithAffinity(candidate, affinity); | 2997 return PositionWithAffinity(candidate, affinity); |
2997 candidate = position.upstream(CanCrossEditingBoundary); | 2998 candidate = position.upstream(CanCrossEditingBoundary); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3031 // Repeat at the next level up. | 3032 // Repeat at the next level up. |
3032 child = parent; | 3033 child = parent; |
3033 } | 3034 } |
3034 | 3035 |
3035 // Everything was anonymous. Give up. | 3036 // Everything was anonymous. Give up. |
3036 return PositionWithAffinity(); | 3037 return PositionWithAffinity(); |
3037 } | 3038 } |
3038 | 3039 |
3039 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset) | 3040 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset) |
3040 { | 3041 { |
3041 return createPositionWithAffinity(offset, DOWNSTREAM); | 3042 return createPositionWithAffinity(offset, TextAffinity::Downstream); |
3042 } | 3043 } |
3043 | 3044 |
3044 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po
sition) | 3045 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po
sition) |
3045 { | 3046 { |
3046 if (position.isNotNull()) | 3047 if (position.isNotNull()) |
3047 return PositionWithAffinity(position); | 3048 return PositionWithAffinity(position); |
3048 | 3049 |
3049 ASSERT(!node()); | 3050 ASSERT(!node()); |
3050 return createPositionWithAffinity(0); | 3051 return createPositionWithAffinity(0); |
3051 } | 3052 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 const blink::LayoutObject* root = object1; | 3403 const blink::LayoutObject* root = object1; |
3403 while (root->parent()) | 3404 while (root->parent()) |
3404 root = root->parent(); | 3405 root = root->parent(); |
3405 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3406 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3406 } else { | 3407 } else { |
3407 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); | 3408 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); |
3408 } | 3409 } |
3409 } | 3410 } |
3410 | 3411 |
3411 #endif | 3412 #endif |
OLD | NEW |