Changeset 34161 in webkit


Ignore:
Timestamp:
May 27, 2008 7:45:01 PM (16 years ago)
Author:
timothy@apple.com
Message:

Fixes a regression where the Image and Font preview views do not
size correctly.

<rdar://problem/5966723> REGRESSION (r33991): Image and font previews
are shrunken and can't be made larger (19281)

Reviewed by Adam Roben.

  • page/inspector/FontView.js: Adjust the font size based only on the

container width minus padding.

  • page/inspector/inspector.css: Updated styles for the image and

font views.

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r34158 r34161  
     12008-05-27  Timothy Hatcher  <timothy@apple.com>
     2
     3        Fixes a regression where the Image and Font preview views do not
     4        size correctly.
     5
     6        <rdar://problem/5966723> REGRESSION (r33991): Image and font previews
     7        are shrunken and can't be made larger (19281)
     8
     9        Reviewed by Adam Roben.
     10
     11        * page/inspector/FontView.js: Adjust the font size based only on the
     12        container width minus padding.
     13        * page/inspector/inspector.css: Updated styles for the image and
     14        font views.
     15
    1162008-05-27  Adam Roben  <aroben@apple.com>
    217
  • trunk/WebCore/page/inspector/FontView.js

    r33403 r34161  
    7272        var width = this.fontPreviewElement.offsetWidth;
    7373
    74         var containerHeight = this.contentElement.offsetHeight;
    7574        var containerWidth = this.contentElement.offsetWidth;
    7675
    77         if (!height || !width || !containerHeight || !containerWidth) {
     76        // Subtract some padding. This should match the padding in the CSS plus room for the scrollbar.
     77        containerWidth -= 40;
     78
     79        if (!height || !width || !containerWidth) {
    7880            this.fontPreviewElement.style.removeProperty("font-size");
    7981            this.fontPreviewElement.style.removeProperty("position");
     
    8688        var fontSizeLineRatio = measureFontSize / realLineHeight;
    8789        var widthRatio = containerWidth / width;
    88         var heightRatio = containerHeight / height;
    89 
    90         if (heightRatio < widthRatio)
    91             var finalFontSize = Math.floor(realLineHeight * heightRatio * fontSizeLineRatio) - 1;
    92         else
    93             var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 1;
     90        var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 1;
    9491
    9592        this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null);
  • trunk/WebCore/page/inspector/inspector.css

    r34096 r34161  
    650650}
    651651
    652 .resource-view.font {
     652.resource-view.font .resource-view-content {
    653653    font-size: 60px;
    654654    white-space: pre-wrap;
    655655    word-wrap: break-word;
    656656    text-align: center;
    657 }
    658 
    659 .resource-view.font .preview {
    660     position: absolute;
    661     margin-top: auto;
    662     margin-bottom: auto;
    663     top: 0;
    664     left: 0;
    665     right: 0;
    666     bottom: 0;
     657    padding: 15px;
    667658}
    668659
    669660.resource-view.image .resource-view-content > .image {
    670     position: relative;
    671     height: 70%;
    672     padding: 20px;
     661    padding: 20px 20px 10px 20px;
     662    text-align: center;
    673663}
    674664
    675665.resource-view.image .resource-view-content > .info {
    676     position: relative;
    677     height: 30%;
    678     padding-top: 10px;
    679     overflow: auto;
     666    padding-bottom: 10px;
    680667    font-size: 11px;
     668    -webkit-user-select: text;
    681669}
    682670
    683671.resource-view.image img {
    684     margin: auto;
    685     position: absolute;
    686     top: 0;
    687     left: 0;
    688     right: 0;
    689     bottom: 0;
    690     max-width: 80%;
    691     max-height: 80%;
     672    max-width: 100%;
     673    max-height: 1000px;
    692674    background-image: url(Images/checker.png);
    693675    -webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);
     676    -webkit-user-select: text;
     677    -webkit-user-drag: auto;
    694678}
    695679
     
    708692    width: 50%;
    709693    text-align: right;
     694    color: rgb(76, 76, 76);
    710695}
    711696
    712697.resource-view.image .infoList dd {
    713698    display: inline-block;
    714     padding-left: 10px;
     699    padding-left: 8px;
    715700    width: 50%;
    716701    text-align: left;
Note: See TracChangeset for help on using the changeset viewer.