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

Side by Side Diff: Source/core/html/RangeInputType.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/RadioInputType.cpp ('k') | Source/core/html/SearchInputType.cpp » ('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) 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 else 225 else
226 return; // Did not match any key binding. 226 return; // Did not match any key binding.
227 227
228 newValue = stepRange.clampValue(newValue); 228 newValue = stepRange.clampValue(newValue);
229 229
230 if (newValue != current) { 230 if (newValue != current) {
231 EventQueueScope scope; 231 EventQueueScope scope;
232 TextFieldEventBehavior eventBehavior = DispatchChangeEvent; 232 TextFieldEventBehavior eventBehavior = DispatchChangeEvent;
233 setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION); 233 setValueAsDecimal(newValue, eventBehavior, IGNORE_EXCEPTION);
234 234
235 if (AXObjectCache* cache = element()->document()->existingAXObjectCache( )) 235 if (AXObjectCache* cache = element()->document().existingAXObjectCache() )
236 cache->postNotification(element(), AXObjectCache::AXValueChanged, tr ue); 236 cache->postNotification(element(), AXObjectCache::AXValueChanged, tr ue);
237 element()->dispatchFormControlChangeEvent(); 237 element()->dispatchFormControlChangeEvent();
238 } 238 }
239 239
240 event->setDefaultHandled(); 240 event->setDefaultHandled();
241 } 241 }
242 242
243 void RangeInputType::createShadowSubtree() 243 void RangeInputType::createShadowSubtree()
244 { 244 {
245 ASSERT(element()->shadow()); 245 ASSERT(element()->shadow());
246 246
247 Document* document = element()->document(); 247 Document* document = &element()->document();
248 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document); 248 RefPtr<HTMLDivElement> track = HTMLDivElement::create(document);
249 track->setPart(AtomicString("-webkit-slider-runnable-track", AtomicString::C onstructFromLiteral)); 249 track->setPart(AtomicString("-webkit-slider-runnable-track", AtomicString::C onstructFromLiteral));
250 track->setAttribute(idAttr, ShadowElementNames::sliderTrack()); 250 track->setAttribute(idAttr, ShadowElementNames::sliderTrack());
251 track->appendChild(SliderThumbElement::create(document)); 251 track->appendChild(SliderThumbElement::create(document));
252 RefPtr<HTMLElement> container = SliderContainerElement::create(document); 252 RefPtr<HTMLElement> container = SliderContainerElement::create(document);
253 container->appendChild(track.release()); 253 container->appendChild(track.release());
254 element()->userAgentShadowRoot()->appendChild(container.release()); 254 element()->userAgentShadowRoot()->appendChild(container.release());
255 } 255 }
256 256
257 RenderObject* RangeInputType::createRenderer(RenderStyle*) const 257 RenderObject* RangeInputType::createRenderer(RenderStyle*) const
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 right = middle; 387 right = middle;
388 } 388 }
389 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative); 389 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal: :infinity(Decimal::Negative);
390 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive); 390 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV alues[middle] : Decimal::infinity(Decimal::Positive);
391 if (closestRight - value < value - closestLeft) 391 if (closestRight - value < value - closestLeft)
392 return closestRight; 392 return closestRight;
393 return closestLeft; 393 return closestLeft;
394 } 394 }
395 395
396 } // namespace WebCore 396 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/RadioInputType.cpp ('k') | Source/core/html/SearchInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698