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

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

Issue 1478573002: Double-clicking whitespace after value text should select the last word in INPUT/TEXTAREA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « third_party/WebKit/Source/core/layout/LayoutTextControl.h ('k') | no next file » | 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 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 HTMLTextFormControlElement* LayoutTextControl::textFormControlElement() const 44 HTMLTextFormControlElement* LayoutTextControl::textFormControlElement() const
45 { 45 {
46 return toHTMLTextFormControlElement(node()); 46 return toHTMLTextFormControlElement(node());
47 } 47 }
48 48
49 HTMLElement* LayoutTextControl::innerEditorElement() const 49 HTMLElement* LayoutTextControl::innerEditorElement() const
50 { 50 {
51 return textFormControlElement()->innerEditorElement(); 51 return textFormControlElement()->innerEditorElement();
52 } 52 }
53 53
54 void LayoutTextControl::addChild(LayoutObject* newChild, LayoutObject* beforeChi ld)
55 {
56 // FIXME: This is a terrible hack to get the caret over the placeholder text since it'll
57 // make us paint the placeholder first. (See https://trac.webkit.org/changes et/118733)
58 Node* node = newChild->node();
59 if (node && node->isElementNode() && toElement(node)->shadowPseudoId() == "- webkit-input-placeholder")
60 LayoutBlockFlow::addChild(newChild, firstChild());
61 else
62 LayoutBlockFlow::addChild(newChild, beforeChild);
63 }
64
65 void LayoutTextControl::styleDidChange(StyleDifference diff, const ComputedStyle * oldStyle) 54 void LayoutTextControl::styleDidChange(StyleDifference diff, const ComputedStyle * oldStyle)
66 { 55 {
67 LayoutBlockFlow::styleDidChange(diff, oldStyle); 56 LayoutBlockFlow::styleDidChange(diff, oldStyle);
68 Element* innerEditor = innerEditorElement(); 57 Element* innerEditor = innerEditorElement();
69 if (!innerEditor) 58 if (!innerEditor)
70 return; 59 return;
71 LayoutBlock* innerEditorLayoutObject = toLayoutBlock(innerEditor->layoutObje ct()); 60 LayoutBlock* innerEditorLayoutObject = toLayoutBlock(innerEditor->layoutObje ct());
72 if (innerEditorLayoutObject) { 61 if (innerEditorLayoutObject) {
73 // We may have set the width and the height in the old style in layout() . 62 // We may have set the width and the height in the old style in layout() .
74 // Reset them now to avoid getting a spurious layout hint. 63 // Reset them now to avoid getting a spurious layout hint.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 280 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
292 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr; 281 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr;
293 if (!placeholderLayoutObject) 282 if (!placeholderLayoutObject)
294 return nullptr; 283 return nullptr;
295 if (relayoutChildren) 284 if (relayoutChildren)
296 layoutScope.setChildNeedsLayout(placeholderLayoutObject); 285 layoutScope.setChildNeedsLayout(placeholderLayoutObject);
297 return placeholderLayoutObject; 286 return placeholderLayoutObject;
298 } 287 }
299 288
300 } // namespace blink 289 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTextControl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698