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

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 15179002: Remove code that is unused after ContextMenu cleanup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove canHandleRequest code from DRT Created 7 years, 7 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/rendering/HitTestResult.h ('k') | Source/core/rendering/RenderBlock.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, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
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,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (!title.isEmpty()) { 228 if (!title.isEmpty()) {
229 if (RenderObject* renderer = titleNode->renderer()) 229 if (RenderObject* renderer = titleNode->renderer())
230 dir = renderer->style()->direction(); 230 dir = renderer->style()->direction();
231 return title; 231 return title;
232 } 232 }
233 } 233 }
234 } 234 }
235 return String(); 235 return String();
236 } 236 }
237 237
238 String HitTestResult::innerTextIfTruncated(TextDirection& dir) const
239 {
240 for (Node* truncatedNode = m_innerNode.get(); truncatedNode; truncatedNode = truncatedNode->parentNode()) {
241 if (!truncatedNode->isElementNode())
242 continue;
243
244 if (RenderObject* renderer = truncatedNode->renderer()) {
245 if (renderer->isRenderBlock()) {
246 RenderBlock* block = toRenderBlock(renderer);
247 if (block->style()->textOverflow()) {
248 for (RootInlineBox* line = block->firstRootBox(); line; line = line->nextRootBox()) {
249 if (line->hasEllipsisBox()) {
250 dir = block->style()->direction();
251 return toElement(truncatedNode)->innerText();
252 }
253 }
254 }
255 break;
256 }
257 }
258 }
259
260 dir = LTR;
261 return String();
262 }
263
264 String displayString(const String& string, const Node* node) 238 String displayString(const String& string, const Node* node)
265 { 239 {
266 if (!node) 240 if (!node)
267 return string; 241 return string;
268 return node->document()->displayStringModifiedByEncoding(string); 242 return node->document()->displayStringModifiedByEncoding(string);
269 } 243 }
270 244
271 String HitTestResult::altDisplayString() const 245 String HitTestResult::altDisplayString() const
272 { 246 {
273 if (!m_innerNonSharedNode) 247 if (!m_innerNonSharedNode)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 #endif 300 #endif
327 ) { 301 ) {
328 Element* element = toElement(m_innerNonSharedNode.get()); 302 Element* element = toElement(m_innerNonSharedNode.get());
329 urlString = element->imageSourceURL(); 303 urlString = element->imageSourceURL();
330 } else 304 } else
331 return KURL(); 305 return KURL();
332 306
333 return m_innerNonSharedNode->document()->completeURL(stripLeadingAndTrailing HTMLSpaces(urlString)); 307 return m_innerNonSharedNode->document()->completeURL(stripLeadingAndTrailing HTMLSpaces(urlString));
334 } 308 }
335 309
336 KURL HitTestResult::absolutePDFURL() const
337 {
338 if (!(m_innerNonSharedNode && m_innerNonSharedNode->document()))
339 return KURL();
340
341 if (!m_innerNonSharedNode->hasTagName(embedTag) && !m_innerNonSharedNode->ha sTagName(objectTag))
342 return KURL();
343
344 HTMLPlugInImageElement* element = toHTMLPlugInImageElement(m_innerNonSharedN ode.get());
345 KURL url = m_innerNonSharedNode->document()->completeURL(stripLeadingAndTrai lingHTMLSpaces(element->url()));
346 if (!url.isValid())
347 return KURL();
348
349 if (element->serviceType() == "application/pdf" || (element->serviceType().i sEmpty() && url.path().lower().endsWith(".pdf")))
350 return url;
351 return KURL();
352 }
353
354 KURL HitTestResult::absoluteMediaURL() const 310 KURL HitTestResult::absoluteMediaURL() const
355 { 311 {
356 if (HTMLMediaElement* mediaElt = mediaElement()) 312 if (HTMLMediaElement* mediaElt = mediaElement())
357 return mediaElt->currentSrc(); 313 return mediaElt->currentSrc();
358 return KURL(); 314 return KURL();
359 } 315 }
360 316
361 bool HitTestResult::mediaSupportsFullscreen() const
362 {
363 HTMLMediaElement* mediaElt(mediaElement());
364 return (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag) && mediaElt->s upportsFullscreen());
365 }
366
367 HTMLMediaElement* HitTestResult::mediaElement() const 317 HTMLMediaElement* HitTestResult::mediaElement() const
368 { 318 {
369 if (!(m_innerNonSharedNode && m_innerNonSharedNode->document())) 319 if (!(m_innerNonSharedNode && m_innerNonSharedNode->document()))
370 return 0; 320 return 0;
371 321
372 if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()-> isMedia())) 322 if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()-> isMedia()))
373 return 0; 323 return 0;
374 324
375 if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonShare dNode->hasTagName(HTMLNames::audioTag)) 325 if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonShare dNode->hasTagName(HTMLNames::audioTag))
376 return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get()); 326 return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
377 return 0; 327 return 0;
378 } 328 }
379 329
380 void HitTestResult::toggleMediaControlsDisplay() const
381 {
382 if (HTMLMediaElement* mediaElt = mediaElement())
383 mediaElt->setControls(!mediaElt->controls());
384 }
385
386 void HitTestResult::toggleMediaLoopPlayback() const
387 {
388 if (HTMLMediaElement* mediaElt = mediaElement())
389 mediaElt->setLoop(!mediaElt->loop());
390 }
391
392 void HitTestResult::enterFullscreenForVideo() const
393 {
394 HTMLMediaElement* mediaElt(mediaElement());
395 if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
396 HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
397 if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen())
398 videoElt->enterFullscreen();
399 }
400 }
401
402 bool HitTestResult::mediaControlsEnabled() const
403 {
404 if (HTMLMediaElement* mediaElt = mediaElement())
405 return mediaElt->controls();
406 return false;
407 }
408
409 bool HitTestResult::mediaLoopEnabled() const
410 {
411 if (HTMLMediaElement* mediaElt = mediaElement())
412 return mediaElt->loop();
413 return false;
414 }
415
416 bool HitTestResult::mediaPlaying() const
417 {
418 if (HTMLMediaElement* mediaElt = mediaElement())
419 return !mediaElt->paused();
420 return false;
421 }
422
423 void HitTestResult::toggleMediaPlayState() const
424 {
425 if (HTMLMediaElement* mediaElt = mediaElement())
426 mediaElt->togglePlayState();
427 }
428
429 bool HitTestResult::mediaHasAudio() const
430 {
431 if (HTMLMediaElement* mediaElt = mediaElement())
432 return mediaElt->hasAudio();
433 return false;
434 }
435
436 bool HitTestResult::mediaIsVideo() const
437 {
438 if (HTMLMediaElement* mediaElt = mediaElement())
439 return mediaElt->hasTagName(HTMLNames::videoTag);
440 return false;
441 }
442
443 bool HitTestResult::mediaMuted() const
444 {
445 if (HTMLMediaElement* mediaElt = mediaElement())
446 return mediaElt->muted();
447 return false;
448 }
449
450 void HitTestResult::toggleMediaMuteState() const
451 {
452 if (HTMLMediaElement* mediaElt = mediaElement())
453 mediaElt->setMuted(!mediaElt->muted());
454 }
455
456 KURL HitTestResult::absoluteLinkURL() const 330 KURL HitTestResult::absoluteLinkURL() const
457 { 331 {
458 if (!(m_innerURLElement && m_innerURLElement->document())) 332 if (!(m_innerURLElement && m_innerURLElement->document()))
459 return KURL(); 333 return KURL();
460 334
461 AtomicString urlString; 335 AtomicString urlString;
462 if (m_innerURLElement->hasTagName(aTag) || m_innerURLElement->hasTagName(are aTag) || m_innerURLElement->hasTagName(linkTag)) 336 if (m_innerURLElement->hasTagName(aTag) || m_innerURLElement->hasTagName(are aTag) || m_innerURLElement->hasTagName(linkTag))
463 urlString = m_innerURLElement->getAttribute(hrefAttr); 337 urlString = m_innerURLElement->getAttribute(hrefAttr);
464 #if ENABLE(SVG) 338 #if ENABLE(SVG)
465 else if (m_innerURLElement->hasTagName(SVGNames::aTag)) 339 else if (m_innerURLElement->hasTagName(SVGNames::aTag))
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 { 487 {
614 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) { 488 for (Node* node = m_innerNode.get(); node; node = node->parentNode()) {
615 if (node->isElementNode()) 489 if (node->isElementNode())
616 return toElement(node); 490 return toElement(node);
617 } 491 }
618 492
619 return 0; 493 return 0;
620 } 494 }
621 495
622 } // namespace WebCore 496 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestResult.h ('k') | Source/core/rendering/RenderBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698