| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 LayoutRect AXRenderObject::computeElementRect() const | 2388 LayoutRect AXRenderObject::computeElementRect() const |
| 2389 { | 2389 { |
| 2390 RenderObject* obj = m_renderer; | 2390 RenderObject* obj = m_renderer; |
| 2391 | 2391 |
| 2392 if (!obj) | 2392 if (!obj) |
| 2393 return LayoutRect(); | 2393 return LayoutRect(); |
| 2394 | 2394 |
| 2395 if (obj->node()) // If we are a continuation, we want to make sure to use th
e primary renderer. | 2395 if (obj->node()) // If we are a continuation, we want to make sure to use th
e primary renderer. |
| 2396 obj = obj->node()->renderer(); | 2396 obj = obj->node()->renderer(); |
| 2397 | 2397 |
| 2398 // absoluteFocusRingQuads will query the hierarchy below this element, which
for large webpages can be very slow. | 2398 // absoluteFocusRingBoundingBox will query the hierarchy below this element,
which for large webpages can be very slow. |
| 2399 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. | 2399 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. |
| 2400 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. | 2400 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. |
| 2401 Vector<FloatQuad> quads; | |
| 2402 | 2401 |
| 2403 if (obj->isText()) | 2402 LayoutRect result; |
| 2403 if (obj->isText()) { |
| 2404 Vector<FloatQuad> quads; |
| 2404 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); | 2405 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); |
| 2405 else if (isWebArea() || obj->isSVGRoot()) | 2406 result = boundingBoxForQuads(obj, quads); |
| 2406 obj->absoluteQuads(quads); | 2407 } else if (isWebArea() || obj->isSVGRoot()) { |
| 2407 else | 2408 result = obj->absoluteBoundingBoxRect(); |
| 2408 obj->absoluteFocusRingQuads(quads); | 2409 } else { |
| 2409 | 2410 result = obj->absoluteFocusRingBoundingBoxRect(); |
| 2410 LayoutRect result = boundingBoxForQuads(obj, quads); | 2411 } |
| 2411 | 2412 |
| 2412 Document* document = this->document(); | 2413 Document* document = this->document(); |
| 2413 if (document && document->isSVGDocument()) | 2414 if (document && document->isSVGDocument()) |
| 2414 offsetBoundingBoxForRemoteSVGElement(result); | 2415 offsetBoundingBoxForRemoteSVGElement(result); |
| 2415 if (document && document->frame() && document->frame()->pagePopupOwner()) { | 2416 if (document && document->frame() && document->frame()->pagePopupOwner()) { |
| 2416 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc
ation(); | 2417 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc
ation(); |
| 2417 IntPoint mainOrigin = axObjectCache()->rootObject()->documentFrameView()
->contentsToScreen(IntRect()).location(); | 2418 IntPoint mainOrigin = axObjectCache()->rootObject()->documentFrameView()
->contentsToScreen(IntRect()).location(); |
| 2418 result.moveBy(IntPoint(popupOrigin - mainOrigin)); | 2419 result.moveBy(IntPoint(popupOrigin - mainOrigin)); |
| 2419 } | 2420 } |
| 2420 | 2421 |
| 2421 // The size of the web area should be the content size, not the clipped size
. | 2422 // The size of the web area should be the content size, not the clipped size
. |
| 2422 if (isWebArea() && obj->frame()->view()) | 2423 if (isWebArea() && obj->frame()->view()) |
| 2423 result.setSize(obj->frame()->view()->contentsSize()); | 2424 result.setSize(obj->frame()->view()->contentsSize()); |
| 2424 | 2425 |
| 2425 // Checkboxes and radio buttons include their label as part of their rect. | 2426 // Checkboxes and radio buttons include their label as part of their rect. |
| 2426 if (isCheckboxOrRadio()) { | 2427 if (isCheckboxOrRadio()) { |
| 2427 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; | 2428 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; |
| 2428 if (label && label->renderer()) { | 2429 if (label && label->renderer()) { |
| 2429 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2430 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
| 2430 result.unite(labelRect); | 2431 result.unite(labelRect); |
| 2431 } | 2432 } |
| 2432 } | 2433 } |
| 2433 | 2434 |
| 2434 return result; | 2435 return result; |
| 2435 } | 2436 } |
| 2436 | 2437 |
| 2437 } // namespace blink | 2438 } // namespace blink |
| OLD | NEW |