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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2683233005: Set caret width based on device scale factor (Closed)
Patch Set: Fix compile error Created 3 years, 10 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
OLDNEW
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. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 10 matching lines...) Expand all
21 * 21 *
22 * You should have received a copy of the GNU Library General Public License 22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to 23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA. 25 * Boston, MA 02110-1301, USA.
26 * 26 *
27 */ 27 */
28 28
29 #include "core/layout/LayoutObject.h" 29 #include "core/layout/LayoutObject.h"
30 30
31 #include <algorithm>
32 #include <memory>
31 #include "core/animation/ElementAnimations.h" 33 #include "core/animation/ElementAnimations.h"
32 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
33 #include "core/dom/AXObjectCache.h" 35 #include "core/dom/AXObjectCache.h"
34 #include "core/dom/ElementTraversal.h" 36 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/StyleChangeReason.h" 37 #include "core/dom/StyleChangeReason.h"
36 #include "core/dom/StyleEngine.h" 38 #include "core/dom/StyleEngine.h"
37 #include "core/dom/shadow/ShadowRoot.h" 39 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/editing/EditingUtilities.h" 40 #include "core/editing/EditingUtilities.h"
39 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
40 #include "core/editing/TextAffinity.h" 42 #include "core/editing/TextAffinity.h"
(...skipping 29 matching lines...) Expand all
70 #include "core/layout/api/LayoutAPIShim.h" 72 #include "core/layout/api/LayoutAPIShim.h"
71 #include "core/layout/api/LayoutPartItem.h" 73 #include "core/layout/api/LayoutPartItem.h"
72 #include "core/layout/ng/layout_ng_block_flow.h" 74 #include "core/layout/ng/layout_ng_block_flow.h"
73 #include "core/page/AutoscrollController.h" 75 #include "core/page/AutoscrollController.h"
74 #include "core/page/Page.h" 76 #include "core/page/Page.h"
75 #include "core/paint/ObjectPaintInvalidator.h" 77 #include "core/paint/ObjectPaintInvalidator.h"
76 #include "core/paint/ObjectPaintProperties.h" 78 #include "core/paint/ObjectPaintProperties.h"
77 #include "core/paint/PaintLayer.h" 79 #include "core/paint/PaintLayer.h"
78 #include "core/style/ContentData.h" 80 #include "core/style/ContentData.h"
79 #include "core/style/CursorData.h" 81 #include "core/style/CursorData.h"
82 #include "platform/HostWindow.h"
80 #include "platform/InstanceCounters.h" 83 #include "platform/InstanceCounters.h"
81 #include "platform/RuntimeEnabledFeatures.h" 84 #include "platform/RuntimeEnabledFeatures.h"
82 #include "platform/geometry/TransformState.h" 85 #include "platform/geometry/TransformState.h"
83 #include "platform/graphics/GraphicsLayer.h" 86 #include "platform/graphics/GraphicsLayer.h"
84 #include "platform/instrumentation/tracing/TracedValue.h" 87 #include "platform/instrumentation/tracing/TracedValue.h"
85 #include "wtf/allocator/Partitions.h" 88 #include "wtf/allocator/Partitions.h"
86 #include "wtf/text/StringBuilder.h" 89 #include "wtf/text/StringBuilder.h"
87 #include "wtf/text/WTFString.h" 90 #include "wtf/text/WTFString.h"
88 #include <algorithm>
89 #include <memory>
90 #ifndef NDEBUG 91 #ifndef NDEBUG
91 #include <stdio.h> 92 #include <stdio.h>
92 #endif 93 #endif
93 94
94 namespace blink { 95 namespace blink {
95 96
96 namespace { 97 namespace {
97 98
98 static bool gModifyLayoutTreeStructureAnyState = false; 99 static bool gModifyLayoutTreeStructureAnyState = false;
99 100
100 } // namespace 101 } // namespace
101 102
102 const LayoutUnit& caretWidth() { 103 const LayoutUnit& caretWidth(HostWindow* host) {
103 static LayoutUnit gCaretWidth(1); 104 static LayoutUnit gCaretWidth(host->windowToViewportScalar(1));
Xianzhu 2017/02/10 22:53:55 Does host->windowToViewportScalar(1) always return
oshima 2017/02/10 22:57:23 No, two tabs may have different scale factor.
Xianzhu 2017/02/10 23:04:13 Then the above code is incorrect because the stati
104 return gCaretWidth; 105 return gCaretWidth;
105 } 106 }
106 107
107 #if DCHECK_IS_ON() 108 #if DCHECK_IS_ON()
108 109
109 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope( 110 LayoutObject::SetLayoutNeededForbiddenScope::SetLayoutNeededForbiddenScope(
110 LayoutObject& layoutObject) 111 LayoutObject& layoutObject)
111 : m_layoutObject(layoutObject), 112 : m_layoutObject(layoutObject),
112 m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) { 113 m_preexistingForbidden(m_layoutObject.isSetNeedsLayoutForbidden()) {
113 m_layoutObject.setNeedsLayoutIsForbidden(true); 114 m_layoutObject.setNeedsLayoutIsForbidden(true);
(...skipping 3383 matching lines...) Expand 10 before | Expand all | Expand 10 after
3497 const blink::LayoutObject* root = object1; 3498 const blink::LayoutObject* root = object1;
3498 while (root->parent()) 3499 while (root->parent())
3499 root = root->parent(); 3500 root = root->parent();
3500 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3501 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3501 } else { 3502 } else {
3502 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3503 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3503 } 3504 }
3504 } 3505 }
3505 3506
3506 #endif 3507 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698