Skip to content
  • shinyak@chromium.org's avatar
    [Chromium] Cannot copy text when selecting readonly (or disabled) input elements · f803a768
    shinyak@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=106287
    
    Reviewed by Hajime Morita.
    
    .:
    
    * Source/autotools/symbols.filter:
    
    Source/WebCore:
    
    When an input element is disabled or readonly, its inner element is not editable. So its rootEditableElement
    does not exist. In WebViewImpl::caretOrSelectionRange, if rootEditableElement does not exist, it uses
    a document element. However, the inner element and document element have a different tree scope, the selection range
    cannot be gotten correctly.
    
    We should use ShadowRoot instead of document so that we can stay in the same tree scope.
    
    * WebCore.exp.in:
    * editing/FrameSelection.cpp:
    (WebCore::FrameSelection::rootEditableElementOrTreeScopeRootNode): Added. Returns ShadowRoot so that we can
    stay in the same tree scope.
    (WebCore):
    * editing/FrameSelection.h:
    (FrameSelection):
    * editing/TextIterator.cpp:
    (WebCore::TextIterator::getLocationAndLengthFromRange):
    * editing/TextIterator.h:
    (TextIterator):
    
    Source/WebKit/chromium:
    
    When an input element is disabled or readonly, its inner element is not editable. So its rootEditableElement
    does not exist. In WebViewImpl::caretOrSelectionRange, if rootEditableElement does not exist, it uses
    a document element. However, the inner element and document element have a different tree scope, selection range
    cannot be gotten correctly.
    
    We should use ShadowRoot instead of document so that we can stay in the same tree scope.
    
    * src/WebViewImpl.cpp:
    (WebKit::WebViewImpl::caretOrSelectionRange):
    * tests/WebViewTest.cpp:
    * tests/data/selection_disabled.html: Added.
    * tests/data/selection_readonly.html: Added.
    
    Source/WebKit/win:
    
    * WebKit.vcproj/WebKitExports.def.in:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@141196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f803a768