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

Side by Side Diff: Source/core/layout/LayoutTextControlSingleLine.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutTextControlSingleLine.h ('k') | Source/core/layout/LayoutTheme.h » ('j') | 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, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2010 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 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if (editingViewPortElement()->layoutBox()) 220 if (editingViewPortElement()->layoutBox())
221 pointInParent -= toLayoutSize(editingViewPortElement()->layoutBo x()->location()); 221 pointInParent -= toLayoutSize(editingViewPortElement()->layoutBo x()->location());
222 if (container->layoutBox()) 222 if (container->layoutBox())
223 pointInParent -= toLayoutSize(container->layoutBox()->location() ); 223 pointInParent -= toLayoutSize(container->layoutBox()->location() );
224 } 224 }
225 hitInnerEditorElement(result, pointInParent, accumulatedOffset); 225 hitInnerEditorElement(result, pointInParent, accumulatedOffset);
226 } 226 }
227 return true; 227 return true;
228 } 228 }
229 229
230 void LayoutTextControlSingleLine::styleDidChange(StyleDifference diff, const Lay outStyle* oldStyle) 230 void LayoutTextControlSingleLine::styleDidChange(StyleDifference diff, const Com putedStyle* oldStyle)
231 { 231 {
232 m_desiredInnerEditorLogicalHeight = -1; 232 m_desiredInnerEditorLogicalHeight = -1;
233 LayoutTextControl::styleDidChange(diff, oldStyle); 233 LayoutTextControl::styleDidChange(diff, oldStyle);
234 234
235 // We may have set the width and the height in the old style in layout(). 235 // We may have set the width and the height in the old style in layout().
236 // Reset them now to avoid getting a spurious layout hint. 236 // Reset them now to avoid getting a spurious layout hint.
237 Element* viewPort = editingViewPortElement(); 237 Element* viewPort = editingViewPortElement();
238 if (LayoutObject* viewPortRenderer = viewPort ? viewPort->layoutObject() : 0 ) { 238 if (LayoutObject* viewPortRenderer = viewPort ? viewPort->layoutObject() : 0 ) {
239 viewPortRenderer->mutableStyleRef().setHeight(Length()); 239 viewPortRenderer->mutableStyleRef().setHeight(Length());
240 viewPortRenderer->mutableStyleRef().setWidth(Length()); 240 viewPortRenderer->mutableStyleRef().setWidth(Length());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 // For text inputs, IE adds some extra width. 324 // For text inputs, IE adds some extra width.
325 if (maxCharWidth > 0.f) 325 if (maxCharWidth > 0.f)
326 result += maxCharWidth - charWidth; 326 result += maxCharWidth - charWidth;
327 327
328 if (includesDecoration) { 328 if (includesDecoration) {
329 HTMLElement* spinButton = innerSpinButtonElement(); 329 HTMLElement* spinButton = innerSpinButtonElement();
330 if (LayoutBox* spinRenderer = spinButton ? spinButton->layoutBox() : 0) { 330 if (LayoutBox* spinRenderer = spinButton ? spinButton->layoutBox() : 0) {
331 result += spinRenderer->borderAndPaddingLogicalWidth(); 331 result += spinRenderer->borderAndPaddingLogicalWidth();
332 // Since the width of spinRenderer is not calculated yet, spinRender er->logicalWidth() returns 0. 332 // Since the width of spinRenderer is not calculated yet, spinRender er->logicalWidth() returns 0.
333 // So computedStyle()->logicalWidth() is used instead. 333 // So ensureComputedStyle()->logicalWidth() is used instead.
334 result += spinButton->computedStyle()->logicalWidth().value(); 334 result += spinButton->ensureComputedStyle()->logicalWidth().value();
335 } 335 }
336 } 336 }
337 337
338 return result; 338 return result;
339 } 339 }
340 340
341 LayoutUnit LayoutTextControlSingleLine::computeControlLogicalHeight(LayoutUnit l ineHeight, LayoutUnit nonContentHeight) const 341 LayoutUnit LayoutTextControlSingleLine::computeControlLogicalHeight(LayoutUnit l ineHeight, LayoutUnit nonContentHeight) const
342 { 342 {
343 return lineHeight + nonContentHeight; 343 return lineHeight + nonContentHeight;
344 } 344 }
345 345
346 PassRefPtr<LayoutStyle> LayoutTextControlSingleLine::createInnerEditorStyle(cons t LayoutStyle& startStyle) const 346 PassRefPtr<ComputedStyle> LayoutTextControlSingleLine::createInnerEditorStyle(co nst ComputedStyle& startStyle) const
347 { 347 {
348 RefPtr<LayoutStyle> textBlockStyle = LayoutStyle::create(); 348 RefPtr<ComputedStyle> textBlockStyle = ComputedStyle::create();
349 textBlockStyle->inheritFrom(startStyle); 349 textBlockStyle->inheritFrom(startStyle);
350 adjustInnerEditorStyle(*textBlockStyle); 350 adjustInnerEditorStyle(*textBlockStyle);
351 351
352 textBlockStyle->setWhiteSpace(PRE); 352 textBlockStyle->setWhiteSpace(PRE);
353 textBlockStyle->setOverflowWrap(NormalOverflowWrap); 353 textBlockStyle->setOverflowWrap(NormalOverflowWrap);
354 textBlockStyle->setOverflowX(OHIDDEN); 354 textBlockStyle->setOverflowX(OHIDDEN);
355 textBlockStyle->setOverflowY(OHIDDEN); 355 textBlockStyle->setOverflowY(OHIDDEN);
356 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip); 356 textBlockStyle->setTextOverflow(textShouldBeTruncated() ? TextOverflowEllips is : TextOverflowClip);
357 357
358 if (m_desiredInnerEditorLogicalHeight >= 0) 358 if (m_desiredInnerEditorLogicalHeight >= 0)
359 textBlockStyle->setLogicalHeight(Length(m_desiredInnerEditorLogicalHeigh t, Fixed)); 359 textBlockStyle->setLogicalHeight(Length(m_desiredInnerEditorLogicalHeigh t, Fixed));
360 // Do not allow line-height to be smaller than our default. 360 // Do not allow line-height to be smaller than our default.
361 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta lLine, PositionOfInteriorLineBoxes)) 361 if (textBlockStyle->fontMetrics().lineSpacing() > lineHeight(true, Horizonta lLine, PositionOfInteriorLineBoxes))
362 textBlockStyle->setLineHeight(LayoutStyle::initialLineHeight()); 362 textBlockStyle->setLineHeight(ComputedStyle::initialLineHeight());
363 363
364 textBlockStyle->setDisplay(BLOCK); 364 textBlockStyle->setDisplay(BLOCK);
365 textBlockStyle->setUnique(); 365 textBlockStyle->setUnique();
366 366
367 if (inputElement()->shouldRevealPassword()) 367 if (inputElement()->shouldRevealPassword())
368 textBlockStyle->setTextSecurity(TSNONE); 368 textBlockStyle->setTextSecurity(TSNONE);
369 369
370 return textBlockStyle.release(); 370 return textBlockStyle.release();
371 } 371 }
372 372
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (innerEditorElement()) 431 if (innerEditorElement())
432 innerEditorElement()->setScrollTop(newTop); 432 innerEditorElement()->setScrollTop(newTop);
433 } 433 }
434 434
435 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const 435 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const
436 { 436 {
437 return toHTMLInputElement(node()); 437 return toHTMLInputElement(node());
438 } 438 }
439 439
440 } 440 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTextControlSingleLine.h ('k') | Source/core/layout/LayoutTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698