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

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

Issue 1365853003: LayoutBox::scrollRectToVisible doesn't respect overflow:hidden property. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle case when overflow-x:hidden and y:scroll Created 5 years, 3 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) 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 #include "core/layout/LayoutTextControl.h" 23 #include "core/layout/LayoutTextControl.h"
24 24
25 #include "core/html/HTMLTextFormControlElement.h" 25 #include "core/html/HTMLTextFormControlElement.h"
26 #include "core/layout/HitTestResult.h" 26 #include "core/layout/HitTestResult.h"
27 #include "core/layout/LayoutTheme.h" 27 #include "core/layout/LayoutTheme.h"
28 #include "core/layout/TextRunConstructor.h" 28 #include "core/layout/TextRunConstructor.h"
29 #include "core/paint/DeprecatedPaintLayer.h"
29 #include "platform/scroll/ScrollbarTheme.h" 30 #include "platform/scroll/ScrollbarTheme.h"
30 #include "wtf/text/CharacterNames.h" 31 #include "wtf/text/CharacterNames.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 LayoutTextControl::LayoutTextControl(HTMLTextFormControlElement* element) 35 LayoutTextControl::LayoutTextControl(HTMLTextFormControlElement* element)
35 : LayoutBlockFlow(element) 36 : LayoutBlockFlow(element)
36 { 37 {
37 ASSERT(element); 38 ASSERT(element);
38 } 39 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // We may have set the width and the height in the old style in layout() . 74 // 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. 75 // Reset them now to avoid getting a spurious layout hint.
75 innerEditorLayoutObject->mutableStyleRef().setHeight(Length()); 76 innerEditorLayoutObject->mutableStyleRef().setHeight(Length());
76 innerEditorLayoutObject->mutableStyleRef().setWidth(Length()); 77 innerEditorLayoutObject->mutableStyleRef().setWidth(Length());
77 innerEditorLayoutObject->setStyle(createInnerEditorStyle(styleRef())); 78 innerEditorLayoutObject->setStyle(createInnerEditorStyle(styleRef()));
78 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo rTracing::create(StyleChangeReason::Control)); 79 innerEditor->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo rTracing::create(StyleChangeReason::Control));
79 } 80 }
80 textFormControlElement()->updatePlaceholderVisibility(); 81 textFormControlElement()->updatePlaceholderVisibility();
81 } 82 }
82 83
84 void LayoutTextControl::scrollRectToVisible(const LayoutRect& rect, const Scroll Alignment& alignX, const ScrollAlignment& alignY, bool programmaticScroll)
bokan 2015/09/25 22:26:26 I'm not up to speed on what LayoutObjects LayoutTe
85 {
86 LayoutRect newRect = rect;
87
88 // Bring the innerEditor into view first because the scrollRectToVisible cal l
89 // on it skipped it because it has overflow:hidden. See changes made pertain ing
90 // to crbug.com/531525.
91 Element* innerEditor = innerEditorElement();
92 if (!innerEditor)
93 return;
94 LayoutBlock* innerEditorLayoutObject = toLayoutBlock(innerEditor->layoutObje ct());
95 if (innerEditorLayoutObject && innerEditorLayoutObject->hasOverflowClip() && !innerEditorLayoutObject->scrollRestrictedByLineClamp()) {
96 newRect = innerEditorLayoutObject->layer()->scrollableArea()->scrollInto View(rect, alignX, alignY);
97 }
98 LayoutBox::scrollRectToVisible(newRect, alignX, alignY, programmaticScroll);
99 }
100
83 static inline void updateUserModifyProperty(HTMLTextFormControlElement& node, Co mputedStyle& style) 101 static inline void updateUserModifyProperty(HTMLTextFormControlElement& node, Co mputedStyle& style)
84 { 102 {
85 style.setUserModify(node.isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_PLA INTEXT_ONLY); 103 style.setUserModify(node.isDisabledOrReadOnly() ? READ_ONLY : READ_WRITE_PLA INTEXT_ONLY);
86 } 104 }
87 105
88 void LayoutTextControl::adjustInnerEditorStyle(ComputedStyle& textBlockStyle) co nst 106 void LayoutTextControl::adjustInnerEditorStyle(ComputedStyle& textBlockStyle) co nst
89 { 107 {
90 // The inner block, if present, always has its direction set to LTR, 108 // The inner block, if present, always has its direction set to LTR,
91 // so we need to inherit the direction and unicode-bidi style from the eleme nt. 109 // so we need to inherit the direction and unicode-bidi style from the eleme nt.
92 textBlockStyle.setDirection(style()->direction()); 110 textBlockStyle.setDirection(style()->direction());
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 309 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
292 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr; 310 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr;
293 if (!placeholderLayoutObject) 311 if (!placeholderLayoutObject)
294 return nullptr; 312 return nullptr;
295 if (relayoutChildren) 313 if (relayoutChildren)
296 layoutScope.setChildNeedsLayout(placeholderLayoutObject); 314 layoutScope.setChildNeedsLayout(placeholderLayoutObject);
297 return placeholderLayoutObject; 315 return placeholderLayoutObject;
298 } 316 }
299 317
300 } // namespace blink 318 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698