| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (computed_style->AffectedByActive() || computed_style->AffectedByHover()) | 102 if (computed_style->AffectedByActive() || computed_style->AffectedByHover()) |
| 103 return true; | 103 return true; |
| 104 } | 104 } |
| 105 return false; | 105 return false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool NodeIsZoomTarget(Node* node) { | 108 bool NodeIsZoomTarget(Node* node) { |
| 109 if (node->IsTextNode() || node->IsShadowRoot()) | 109 if (node->IsTextNode() || node->IsShadowRoot()) |
| 110 return false; | 110 return false; |
| 111 | 111 |
| 112 ASSERT(node->GetLayoutObject()); | 112 DCHECK(node->GetLayoutObject()); |
| 113 return node->GetLayoutObject()->IsBox(); | 113 return node->GetLayoutObject()->IsBox(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool ProvidesContextMenuItems(Node* node) { | 116 bool ProvidesContextMenuItems(Node* node) { |
| 117 // This function tries to match the nodes that receive special context-menu | 117 // This function tries to match the nodes that receive special context-menu |
| 118 // items in ContextMenuController::populate(), and should be kept uptodate | 118 // items in ContextMenuController::populate(), and should be kept uptodate |
| 119 // with those. | 119 // with those. |
| 120 ASSERT(node->GetLayoutObject() || node->IsShadowRoot()); | 120 ASSERT(node->GetLayoutObject() || node->IsShadowRoot()); |
| 121 if (!node->GetLayoutObject()) | 121 if (!node->GetLayoutObject()) |
| 122 return false; | 122 return false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 153 Vector<FloatQuad>::const_iterator it = quads.begin(); | 153 Vector<FloatQuad>::const_iterator it = quads.begin(); |
| 154 const Vector<FloatQuad>::const_iterator end = quads.end(); | 154 const Vector<FloatQuad>::const_iterator end = quads.end(); |
| 155 for (; it != end; ++it) | 155 for (; it != end; ++it) |
| 156 subtargets.push_back(SubtargetGeometry(node, *it)); | 156 subtargets.push_back(SubtargetGeometry(node, *it)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 static inline void AppendBasicSubtargetsForNode( | 159 static inline void AppendBasicSubtargetsForNode( |
| 160 Node* node, | 160 Node* node, |
| 161 SubtargetGeometryList& subtargets) { | 161 SubtargetGeometryList& subtargets) { |
| 162 // Node guaranteed to have layoutObject due to check in node filter. | 162 // Node guaranteed to have layoutObject due to check in node filter. |
| 163 ASSERT(node->GetLayoutObject()); | 163 DCHECK(node->GetLayoutObject()); |
| 164 | 164 |
| 165 Vector<FloatQuad> quads; | 165 Vector<FloatQuad> quads; |
| 166 node->GetLayoutObject()->AbsoluteQuads(quads); | 166 node->GetLayoutObject()->AbsoluteQuads(quads); |
| 167 | 167 |
| 168 AppendQuadsToSubtargetList(quads, node, subtargets); | 168 AppendQuadsToSubtargetList(quads, node, subtargets); |
| 169 } | 169 } |
| 170 | 170 |
| 171 static inline void AppendContextSubtargetsForNode( | 171 static inline void AppendContextSubtargetsForNode( |
| 172 Node* node, | 172 Node* node, |
| 173 SubtargetGeometryList& subtargets) { | 173 SubtargetGeometryList& subtargets) { |
| 174 // This is a variant of appendBasicSubtargetsForNode that adds special | 174 // This is a variant of appendBasicSubtargetsForNode that adds special |
| 175 // subtargets for selected or auto-selectable parts of text nodes. | 175 // subtargets for selected or auto-selectable parts of text nodes. |
| 176 ASSERT(node->GetLayoutObject()); | 176 DCHECK(node->GetLayoutObject()); |
| 177 | 177 |
| 178 if (!node->IsTextNode()) | 178 if (!node->IsTextNode()) |
| 179 return AppendBasicSubtargetsForNode(node, subtargets); | 179 return AppendBasicSubtargetsForNode(node, subtargets); |
| 180 | 180 |
| 181 Text* text_node = ToText(node); | 181 Text* text_node = ToText(node); |
| 182 LayoutText* text_layout_object = text_node->GetLayoutObject(); | 182 LayoutText* text_layout_object = text_node->GetLayoutObject(); |
| 183 | 183 |
| 184 if (text_layout_object->GetFrame() | 184 if (text_layout_object->GetFrame() |
| 185 ->GetEditor() | 185 ->GetEditor() |
| 186 .Behavior() | 186 .Behavior() |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 228 } |
| 229 Vector<FloatQuad> quads; | 229 Vector<FloatQuad> quads; |
| 230 text_layout_object->AbsoluteQuadsForRange(quads, start_pos, end_pos); | 230 text_layout_object->AbsoluteQuadsForRange(quads, start_pos, end_pos); |
| 231 AppendQuadsToSubtargetList(quads, text_node, subtargets); | 231 AppendQuadsToSubtargetList(quads, text_node, subtargets); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 static inline void AppendZoomableSubtargets(Node* node, | 235 static inline void AppendZoomableSubtargets(Node* node, |
| 236 SubtargetGeometryList& subtargets) { | 236 SubtargetGeometryList& subtargets) { |
| 237 LayoutBox* layout_object = ToLayoutBox(node->GetLayoutObject()); | 237 LayoutBox* layout_object = ToLayoutBox(node->GetLayoutObject()); |
| 238 ASSERT(layout_object); | 238 DCHECK(layout_object); |
| 239 | 239 |
| 240 Vector<FloatQuad> quads; | 240 Vector<FloatQuad> quads; |
| 241 FloatRect border_box_rect(layout_object->BorderBoxRect()); | 241 FloatRect border_box_rect(layout_object->BorderBoxRect()); |
| 242 FloatRect content_box_rect(layout_object->ContentBoxRect()); | 242 FloatRect content_box_rect(layout_object->ContentBoxRect()); |
| 243 quads.push_back(layout_object->LocalToAbsoluteQuad(border_box_rect)); | 243 quads.push_back(layout_object->LocalToAbsoluteQuad(border_box_rect)); |
| 244 if (border_box_rect != content_box_rect) | 244 if (border_box_rect != content_box_rect) |
| 245 quads.push_back(layout_object->LocalToAbsoluteQuad(content_box_rect)); | 245 quads.push_back(layout_object->LocalToAbsoluteQuad(content_box_rect)); |
| 246 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for | 246 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for |
| 247 // floats. | 247 // floats. |
| 248 | 248 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // We compile the list of component absolute quads instead of using the | 313 // We compile the list of component absolute quads instead of using the |
| 314 // bounding rect to be able to perform better hit-testing on inline links on | 314 // bounding rect to be able to perform better hit-testing on inline links on |
| 315 // line-breaks. | 315 // line-breaks. |
| 316 for (unsigned i = 0; i < candidates.size(); i++) { | 316 for (unsigned i = 0; i < candidates.size(); i++) { |
| 317 Node* candidate = candidates[i]; | 317 Node* candidate = candidates[i]; |
| 318 // Skip nodes who's responders are ancestors of other responders. This gives | 318 // Skip nodes who's responders are ancestors of other responders. This gives |
| 319 // preference to the inner-most event-handlers. So that a link is always | 319 // preference to the inner-most event-handlers. So that a link is always |
| 320 // preferred even when contained in an element that monitors all | 320 // preferred even when contained in an element that monitors all |
| 321 // click-events. | 321 // click-events. |
| 322 Node* responding_node = responder_map.at(candidate); | 322 Node* responding_node = responder_map.at(candidate); |
| 323 ASSERT(responding_node); | 323 DCHECK(responding_node); |
| 324 if (ancestors_to_responders_set.Contains(responding_node)) | 324 if (ancestors_to_responders_set.Contains(responding_node)) |
| 325 continue; | 325 continue; |
| 326 // Consolidate bounds for editable content. | 326 // Consolidate bounds for editable content. |
| 327 if (editable_ancestors.Contains(candidate)) | 327 if (editable_ancestors.Contains(candidate)) |
| 328 continue; | 328 continue; |
| 329 candidate->GetDocument().UpdateStyleAndLayoutTree(); | 329 candidate->GetDocument().UpdateStyleAndLayoutTree(); |
| 330 if (HasEditableStyle(*candidate)) { | 330 if (HasEditableStyle(*candidate)) { |
| 331 Node* replacement = candidate; | 331 Node* replacement = candidate; |
| 332 Node* parent = candidate->ParentOrShadowHostNode(); | 332 Node* parent = candidate->ParentOrShadowHostNode(); |
| 333 while (parent && HasEditableStyle(*parent)) { | 333 while (parent && HasEditableStyle(*parent)) { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 const HeapVector<Member<Node>>& nodes) { | 564 const HeapVector<Member<Node>>& nodes) { |
| 565 IntPoint target_point; | 565 IntPoint target_point; |
| 566 TouchAdjustment::SubtargetGeometryList subtargets; | 566 TouchAdjustment::SubtargetGeometryList subtargets; |
| 567 TouchAdjustment::CompileZoomableSubtargets(nodes, subtargets); | 567 TouchAdjustment::CompileZoomableSubtargets(nodes, subtargets); |
| 568 return TouchAdjustment::FindNodeWithLowestDistanceMetric( | 568 return TouchAdjustment::FindNodeWithLowestDistanceMetric( |
| 569 target_node, target_point, target_area, touch_hotspot, touch_area, | 569 target_node, target_point, target_area, touch_hotspot, touch_area, |
| 570 subtargets, TouchAdjustment::ZoomableIntersectionQuotient); | 570 subtargets, TouchAdjustment::ZoomableIntersectionQuotient); |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace blink | 573 } // namespace blink |
| OLD | NEW |