| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Check the visibility of the element. | 123 // Check the visibility of the element. |
| 124 // FIXME: Can we check invisibility by scrollable non-frame elements? | 124 // FIXME: Can we check invisibility by scrollable non-frame elements? |
| 125 IntRect newAnchorRectInViewport = currentView()->contentsToViewport(m_curren
tAnchor->pixelSnappedBoundingBox()); | 125 IntRect newAnchorRectInViewport = currentView()->contentsToViewport(m_curren
tAnchor->pixelSnappedBoundingBox()); |
| 126 | 126 |
| 127 // FIXME: This intersection eliminates the part of the rect outside the root
view. | 127 // FIXME: This intersection eliminates the part of the rect outside the root
view. |
| 128 // If this is meant as a visiblity test, intersecting it against the viewpor
t rect | 128 // If this is meant as a visiblity test, intersecting it against the viewpor
t rect |
| 129 // likely makes more sense. | 129 // likely makes more sense. |
| 130 newAnchorRectInViewport = intersection(currentView()->convertToContainingWin
dow(currentView()->boundsRect()), newAnchorRectInViewport); | 130 newAnchorRectInViewport = intersection(currentView()->convertToRootFrame(cur
rentView()->boundsRect()), newAnchorRectInViewport); |
| 131 if (newAnchorRectInViewport.isEmpty()) { | 131 if (newAnchorRectInViewport.isEmpty()) { |
| 132 hideValidationMessage(*m_currentAnchor); | 132 hideValidationMessage(*m_currentAnchor); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 | 135 |
| 136 IntRect newAnchorRectInViewportInScreen = currentView()->hostWindow()->viewp
ortToScreen(newAnchorRectInViewport); | 136 IntRect newAnchorRectInViewportInScreen = currentView()->hostWindow()->viewp
ortToScreen(newAnchorRectInViewport); |
| 137 if (newAnchorRectInViewportInScreen == m_lastAnchorRectInScreen && m_webView
.pageScaleFactor() == m_lastPageScaleFactor) | 137 if (newAnchorRectInViewportInScreen == m_lastAnchorRectInScreen && m_webView
.pageScaleFactor() == m_lastPageScaleFactor) |
| 138 return; | 138 return; |
| 139 m_lastAnchorRectInScreen = newAnchorRectInViewportInScreen; | 139 m_lastAnchorRectInScreen = newAnchorRectInViewportInScreen; |
| 140 m_lastPageScaleFactor = m_webView.pageScaleFactor(); | 140 m_lastPageScaleFactor = m_webView.pageScaleFactor(); |
| 141 m_webView.client()->moveValidationMessage(newAnchorRectInViewport); | 141 m_webView.client()->moveValidationMessage(newAnchorRectInViewport); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void ValidationMessageClientImpl::willBeDestroyed() | 144 void ValidationMessageClientImpl::willBeDestroyed() |
| 145 { | 145 { |
| 146 if (m_currentAnchor) | 146 if (m_currentAnchor) |
| 147 hideValidationMessage(*m_currentAnchor); | 147 hideValidationMessage(*m_currentAnchor); |
| 148 } | 148 } |
| 149 | 149 |
| 150 DEFINE_TRACE(ValidationMessageClientImpl) | 150 DEFINE_TRACE(ValidationMessageClientImpl) |
| 151 { | 151 { |
| 152 visitor->trace(m_currentAnchor); | 152 visitor->trace(m_currentAnchor); |
| 153 ValidationMessageClient::trace(visitor); | 153 ValidationMessageClient::trace(visitor); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |