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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some !'s and &&'s. De Morgan would be proud. Created 5 years, 5 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, 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 inline HTMLElement* LayoutTextControlSingleLine::innerSpinButtonElement() const 68 inline HTMLElement* LayoutTextControlSingleLine::innerSpinButtonElement() const
69 { 69 {
70 return toHTMLElement(inputElement()->userAgentShadowRoot()->getElementById(S hadowElementNames::spinButton())); 70 return toHTMLElement(inputElement()->userAgentShadowRoot()->getElementById(S hadowElementNames::spinButton()));
71 } 71 }
72 72
73 void LayoutTextControlSingleLine::paint(const PaintInfo& paintInfo, const Layout Point& paintOffset) 73 void LayoutTextControlSingleLine::paint(const PaintInfo& paintInfo, const Layout Point& paintOffset)
74 { 74 {
75 LayoutTextControl::paint(paintInfo, paintOffset); 75 LayoutTextControl::paint(paintInfo, paintOffset);
76 76
77 if (paintInfo.phase == PaintPhaseBlockBackground && m_shouldDrawCapsLockIndi cator) { 77 if (paintInfo.phase == PaintPhaseBlockBackground && m_shouldDrawCapsLockIndi cator) {
78 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.c ontext, *this, paintInfo.phase))
79 return;
80
78 LayoutRect contentsRect = contentBoxRect(); 81 LayoutRect contentsRect = contentBoxRect();
79 82
80 // Center in the block progression direction. 83 // Center in the block progression direction.
81 if (isHorizontalWritingMode()) 84 if (isHorizontalWritingMode())
82 contentsRect.setY((size().height() - contentsRect.height()) / 2); 85 contentsRect.setY((size().height() - contentsRect.height()) / 2);
83 else 86 else
84 contentsRect.setX((size().width() - contentsRect.width()) / 2); 87 contentsRect.setX((size().width() - contentsRect.width()) / 2);
85 88
86 // Convert the rect into the coords used for painting the content 89 // Convert the rect into the coords used for painting the content
87 contentsRect.moveBy(paintOffset + location()); 90 contentsRect.moveBy(paintOffset + location());
88 IntRect snappedRect = pixelSnappedIntRect(contentsRect); 91 IntRect snappedRect = pixelSnappedIntRect(contentsRect);
89 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *this, paintInf o.phase, snappedRect); 92 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *this, paintInf o.phase, snappedRect);
90 if (!recorder.canUseCachedDrawing()) 93 LayoutTheme::theme().painter().paintCapsLockIndicator(this, paintInfo, s nappedRect);
91 LayoutTheme::theme().painter().paintCapsLockIndicator(this, paintInf o, snappedRect);
92 } 94 }
93 } 95 }
94 96
95 LayoutUnit LayoutTextControlSingleLine::computeLogicalHeightLimit() const 97 LayoutUnit LayoutTextControlSingleLine::computeLogicalHeightLimit() const
96 { 98 {
97 return containerElement() ? contentLogicalHeight() : logicalHeight(); 99 return containerElement() ? contentLogicalHeight() : logicalHeight();
98 } 100 }
99 101
100 void LayoutTextControlSingleLine::layout() 102 void LayoutTextControlSingleLine::layout()
101 { 103 {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (innerEditorElement()) 445 if (innerEditorElement())
444 innerEditorElement()->setScrollTop(newTop); 446 innerEditorElement()->setScrollTop(newTop);
445 } 447 }
446 448
447 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const 449 HTMLInputElement* LayoutTextControlSingleLine::inputElement() const
448 { 450 {
449 return toHTMLInputElement(node()); 451 return toHTMLInputElement(node());
450 } 452 }
451 453
452 } 454 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698