OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. |
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "core/events/KeyboardEvent.h" | 47 #include "core/events/KeyboardEvent.h" |
48 #include "core/frame/Settings.h" | 48 #include "core/frame/Settings.h" |
49 #include "core/frame/UseCounter.h" | 49 #include "core/frame/UseCounter.h" |
50 #include "core/html/HTMLBRElement.h" | 50 #include "core/html/HTMLBRElement.h" |
51 #include "core/html/HTMLFormElement.h" | 51 #include "core/html/HTMLFormElement.h" |
52 #include "core/html/HTMLInputElement.h" | 52 #include "core/html/HTMLInputElement.h" |
53 #include "core/html/HTMLMenuElement.h" | 53 #include "core/html/HTMLMenuElement.h" |
54 #include "core/html/HTMLTemplateElement.h" | 54 #include "core/html/HTMLTemplateElement.h" |
55 #include "core/html/HTMLTextFormControlElement.h" | 55 #include "core/html/HTMLTextFormControlElement.h" |
56 #include "core/html/parser/HTMLParserIdioms.h" | 56 #include "core/html/parser/HTMLParserIdioms.h" |
57 #include "core/layout/LayoutBoxModelObject.h" | |
57 #include "core/layout/LayoutObject.h" | 58 #include "core/layout/LayoutObject.h" |
58 #include "core/page/SpatialNavigation.h" | 59 #include "core/page/SpatialNavigation.h" |
59 #include "platform/Language.h" | 60 #include "platform/Language.h" |
60 #include "platform/text/BidiResolver.h" | 61 #include "platform/text/BidiResolver.h" |
61 #include "platform/text/BidiTextRun.h" | 62 #include "platform/text/BidiTextRun.h" |
62 #include "platform/text/TextRunIterator.h" | 63 #include "platform/text/TextRunIterator.h" |
63 #include "wtf/StdLibExtras.h" | 64 #include "wtf/StdLibExtras.h" |
64 #include "wtf/text/CString.h" | 65 #include "wtf/text/CString.h" |
65 | 66 |
66 namespace blink { | 67 namespace blink { |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 event->setDefaultHandled(); | 1045 event->setDefaultHandled(); |
1045 } | 1046 } |
1046 } | 1047 } |
1047 | 1048 |
1048 const AtomicString& HTMLElement::eventParameterName() | 1049 const AtomicString& HTMLElement::eventParameterName() |
1049 { | 1050 { |
1050 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event")); | 1051 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event")); |
1051 return eventString; | 1052 return eventString; |
1052 } | 1053 } |
1053 | 1054 |
1055 int HTMLElement::offsetLeftForBinding() | |
1056 { | |
1057 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | |
1058 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | |
1059 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetLeft(unclosedOffsetParent())), layoutObject->styleRef()).round(); | |
1060 return 0; | |
1061 } | |
1062 | |
1063 int HTMLElement::offsetTopForBinding() | |
1064 { | |
1065 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | |
1066 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | |
1067 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetTop(unclosedOffsetParent())), layoutObject->styleRef()).round(); | |
1068 return 0; | |
1069 } | |
1070 | |
1071 int HTMLElement::offsetWidthForBinding() | |
1072 { | |
1073 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | |
1074 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | |
1075 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetWidth(unclosedOffsetParent())), layoutObject->styleRef()).round(); | |
1076 return 0; | |
1077 } | |
1078 | |
1079 int HTMLElement::offsetHeightForBinding() | |
1080 { | |
1081 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | |
1082 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject()) | |
1083 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetHeight(unclosedOffsetParent())), layoutObject->styleRef()).round(); | |
1084 return 0; | |
1085 } | |
1086 | |
1087 Element* HTMLElement::unclosedOffsetParent() | |
1088 { | |
1089 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this); | |
1090 | |
1091 LayoutObject* layoutObject = this->layoutObject(); | |
1092 if (!layoutObject) | |
1093 return nullptr; | |
1094 | |
1095 Element* element = layoutObject->offsetParent(); | |
1096 while (element && (!element->isUnclosedNodeOf(*this) || (element->isInShadow Tree() && element->containingShadowRoot()->type() == ShadowRootType::UserAgent)) ) | |
hayato
2016/06/27 06:58:32
I do not think it is a good idea to loop here by c
kochi
2016/06/28 07:59:59
That will break LayoutObject::offsetParent, as you
| |
1097 element = element->layoutObject()->offsetParent(); | |
1098 return element; | |
1099 } | |
1100 | |
1054 } // namespace blink | 1101 } // namespace blink |
1055 | 1102 |
1056 #ifndef NDEBUG | 1103 #ifndef NDEBUG |
1057 | 1104 |
1058 // For use in the debugger | 1105 // For use in the debugger |
1059 void dumpInnerHTML(blink::HTMLElement*); | 1106 void dumpInnerHTML(blink::HTMLElement*); |
1060 | 1107 |
1061 void dumpInnerHTML(blink::HTMLElement* element) | 1108 void dumpInnerHTML(blink::HTMLElement* element) |
1062 { | 1109 { |
1063 printf("%s\n", element->innerHTML().ascii().data()); | 1110 printf("%s\n", element->innerHTML().ascii().data()); |
1064 } | 1111 } |
1065 #endif | 1112 #endif |
OLD | NEW |