Reviewed by Adam.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Oct 2006 00:25:31 +0000 (00:25 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Oct 2006 00:25:31 +0000 (00:25 +0000)
        <rdar://problem/4796941> Table deletion outline is misplaced at nytimes.com

        The main table at nytimes.com has a fixed width of 874px, but the table ends
        up overflowing to 963px. We now use overflowWidth() and overflowHeight() to correct
        this. The other bug was a missing top and left of 0px on the container element,
        causing the deletion UI to sometimes be offset below the table.

        Now check for the element's renderer at the beginning of show() and
        return early if it is null.

        * editing/DeleteButtonController.cpp:
        (WebCore::DeleteButtonController::updateOutlineStyle):
        (WebCore::DeleteButtonController::show):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17351 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/editing/DeleteButtonController.cpp

index 6538877ac093163c85dddf81b8f07ecdbc6ad8fc..d53328386b85b2b16ed99518747c74ffe00da705 100644 (file)
@@ -1,3 +1,21 @@
+2006-10-26  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam.
+
+        <rdar://problem/4796941> Table deletion outline is misplaced at nytimes.com
+
+        The main table at nytimes.com has a fixed width of 874px, but the table ends
+        up overflowing to 963px. We now use overflowWidth() and overflowHeight() to correct
+        this. The other bug was a missing top and left of 0px on the container element,
+        causing the deletion UI to sometimes be offset below the table.
+
+        Now check for the element's renderer at the beginning of show() and
+        return early if it is null.
+
+        * editing/DeleteButtonController.cpp:
+        (WebCore::DeleteButtonController::updateOutlineStyle):
+        (WebCore::DeleteButtonController::show):
+
 2006-10-26  Anders Carlsson  <acarlsson@apple.com>
 
         Build fix.
 2006-10-26  Anders Carlsson  <acarlsson@apple.com>
 
         Build fix.
index e3aad49ff46930a8bf66e91b31c892d99f82b7d6..6fc47e1f8cc5b4902108fad257cc9511fd582b8e 100644 (file)
@@ -116,15 +116,15 @@ void DeleteButtonController::updateOutlineStyle()
         return;
 
     CSSMutableStyleDeclaration* style = m_outlineElement->getInlineStyleDecl();
         return;
 
     CSSMutableStyleDeclaration* style = m_outlineElement->getInlineStyleDecl();
-    style->setProperty(CSS_PROP_WIDTH, String::number(m_element->renderer()->offsetWidth()) + "px");
-    style->setProperty(CSS_PROP_HEIGHT, String::number(m_element->renderer()->offsetHeight()) + "px");
+    style->setProperty(CSS_PROP_WIDTH, String::number(m_element->renderer()->overflowWidth()) + "px");
+    style->setProperty(CSS_PROP_HEIGHT, String::number(m_element->renderer()->overflowHeight()) + "px");
 }
 
 void DeleteButtonController::show(HTMLElement* element)
 {
     hide();
 
 }
 
 void DeleteButtonController::show(HTMLElement* element)
 {
     hide();
 
-    if (!(element->renderer() && element->renderer()->isRenderBlock()))
+    if (!element->renderer() || !element->renderer()->isRenderBlock())
         return;
 
     if (!m_frame->editor()->shouldShowDeleteInterface(static_cast<HTMLElement*>(element)))
         return;
 
     if (!m_frame->editor()->shouldShowDeleteInterface(static_cast<HTMLElement*>(element)))
@@ -137,6 +137,8 @@ void DeleteButtonController::show(HTMLElement* element)
 
     CSSMutableStyleDeclaration* style = m_containerElement->getInlineStyleDecl();
     style->setProperty(CSS_PROP_POSITION, CSS_VAL_ABSOLUTE);
 
     CSSMutableStyleDeclaration* style = m_containerElement->getInlineStyleDecl();
     style->setProperty(CSS_PROP_POSITION, CSS_VAL_ABSOLUTE);
+    style->setProperty(CSS_PROP_TOP, "0px");
+    style->setProperty(CSS_PROP_LEFT, "0px");
     style->setProperty(CSS_PROP__WEBKIT_USER_DRAG, CSS_VAL_NONE);
     style->setProperty(CSS_PROP__WEBKIT_USER_SELECT, CSS_VAL_NONE);
     style->setProperty(CSS_PROP__WEBKIT_USER_MODIFY, CSS_VAL_NONE);
     style->setProperty(CSS_PROP__WEBKIT_USER_DRAG, CSS_VAL_NONE);
     style->setProperty(CSS_PROP__WEBKIT_USER_SELECT, CSS_VAL_NONE);
     style->setProperty(CSS_PROP__WEBKIT_USER_MODIFY, CSS_VAL_NONE);
@@ -202,19 +204,17 @@ void DeleteButtonController::show(HTMLElement* element)
         return;
     }
 
         return;
     }
 
-    if (m_element->renderer()) {
-        if (m_element->renderer()->style()->position() == StaticPosition) {
-            m_element->getInlineStyleDecl()->setProperty(CSS_PROP_POSITION, CSS_VAL_RELATIVE);
-            m_wasStaticPositioned = true;
-        }
-
-        if (m_element->renderer()->style()->hasAutoZIndex()) {
-            m_element->getInlineStyleDecl()->setProperty(CSS_PROP_Z_INDEX, "0");
-            m_wasAutoZIndex = true;
-        }
+    if (m_element->renderer()->style()->position() == StaticPosition) {
+        m_element->getInlineStyleDecl()->setProperty(CSS_PROP_POSITION, CSS_VAL_RELATIVE);
+        m_wasStaticPositioned = true;
+    }
 
 
-        m_element->renderer()->repaint(true);
+    if (m_element->renderer()->style()->hasAutoZIndex()) {
+        m_element->getInlineStyleDecl()->setProperty(CSS_PROP_Z_INDEX, "0");
+        m_wasAutoZIndex = true;
     }
     }
+
+    m_element->renderer()->repaint(true);
 }
 
 void DeleteButtonController::hide()
 }
 
 void DeleteButtonController::hide()