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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/RangeInputType.cpp

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 event->setDefaultHandled(); 236 event->setDefaultHandled();
237 } 237 }
238 238
239 void RangeInputType::createShadowSubtree() 239 void RangeInputType::createShadowSubtree()
240 { 240 {
241 ASSERT(element().shadow()); 241 ASSERT(element().shadow());
242 242
243 Document& document = element().document(); 243 Document& document = element().document();
244 RefPtrWillBeRawPtr<HTMLDivElement> track = HTMLDivElement::create(document); 244 RefPtrWillBeRawPtr<HTMLDivElement> track = HTMLDivElement::create(document);
245 track->setShadowPseudoId(AtomicString("-webkit-slider-runnable-track", Atomi cString::ConstructFromLiteral)); 245 track->setShadowPseudoId(AtomicString("-webkit-slider-runnable-track"));
246 track->setAttribute(idAttr, ShadowElementNames::sliderTrack()); 246 track->setAttribute(idAttr, ShadowElementNames::sliderTrack());
247 track->appendChild(SliderThumbElement::create(document)); 247 track->appendChild(SliderThumbElement::create(document));
248 RefPtrWillBeRawPtr<HTMLElement> container = SliderContainerElement::create(d ocument); 248 RefPtrWillBeRawPtr<HTMLElement> container = SliderContainerElement::create(d ocument);
249 container->appendChild(track.release()); 249 container->appendChild(track.release());
250 element().userAgentShadowRoot()->appendChild(container.release()); 250 element().userAgentShadowRoot()->appendChild(container.release());
251 } 251 }
252 252
253 LayoutObject* RangeInputType::createLayoutObject(const ComputedStyle&) const 253 LayoutObject* RangeInputType::createLayoutObject(const ComputedStyle&) const
254 { 254 {
255 return new LayoutSlider(&element()); 255 return new LayoutSlider(&element());
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 right = middle; 397 right = middle;
398 } 398 }
399 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 399 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative);
400 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive); 400 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
401 if (closestRight - value < value - closestLeft) 401 if (closestRight - value < value - closestLeft)
402 return closestRight; 402 return closestRight;
403 return closestLeft; 403 return closestLeft;
404 } 404 }
405 405
406 } // namespace blink 406 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698