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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 442433002: Not allowing user to type more chars than max length value for text field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: few nits resolved Created 6 years, 4 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java ('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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 void RenderViewImpl::focusNext() { 2012 void RenderViewImpl::focusNext() {
2013 Send(new ViewHostMsg_TakeFocus(routing_id_, false)); 2013 Send(new ViewHostMsg_TakeFocus(routing_id_, false));
2014 } 2014 }
2015 2015
2016 void RenderViewImpl::focusPrevious() { 2016 void RenderViewImpl::focusPrevious() {
2017 Send(new ViewHostMsg_TakeFocus(routing_id_, true)); 2017 Send(new ViewHostMsg_TakeFocus(routing_id_, true));
2018 } 2018 }
2019 2019
2020 void RenderViewImpl::focusedNodeChanged(const WebNode& node) { 2020 void RenderViewImpl::focusedNodeChanged(const WebNode& node) {
2021 has_scrolled_focused_editable_node_into_rect_ = false; 2021 has_scrolled_focused_editable_node_into_rect_ = false;
2022 2022 int max_length_;
2023 Send(new ViewHostMsg_FocusedNodeChanged(routing_id_, IsEditableNode(node))); 2023 if (IsEditableNode(node)) {
2024 const WebElement& element = node.toConst<WebElement>();
2025 if (toWebInputElement(&element))
2026 max_length_ = toWebInputElement(&element)->maxLength();
2027 }
2028 Send(new ViewHostMsg_FocusedNodeChanged(
2029 routing_id_, IsEditableNode(node), max_length_));
2024 2030
2025 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node)); 2031 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FocusedNodeChanged(node));
2026 2032
2027 // TODO(dmazzoni): this should be part of RenderFrameObserver. 2033 // TODO(dmazzoni): this should be part of RenderFrameObserver.
2028 main_render_frame()->FocusedNodeChanged(node); 2034 main_render_frame()->FocusedNodeChanged(node);
2029 } 2035 }
2030 2036
2031 void RenderViewImpl::didUpdateLayout() { 2037 void RenderViewImpl::didUpdateLayout() {
2032 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout()); 2038 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidUpdateLayout());
2033 2039
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 std::vector<gfx::Size> sizes; 4296 std::vector<gfx::Size> sizes;
4291 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4297 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4292 if (!url.isEmpty()) 4298 if (!url.isEmpty())
4293 urls.push_back( 4299 urls.push_back(
4294 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4300 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4295 } 4301 }
4296 SendUpdateFaviconURL(urls); 4302 SendUpdateFaviconURL(urls);
4297 } 4303 }
4298 4304
4299 } // namespace content 4305 } // namespace content
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698